js 插入meta标签


js 插入meta标签

例如:

1
2
3
4
<meta property="al:android:app_name" content="lss" />
<meta property="al:android:url" content="lss://com.lss/app?x=web" />
<meta property="al:android:package" content="com.lls.lss" />
<meta property="al:al:android:class" content="org.cocos2dx.javascript.AppActivity" />

js为

1
2
3
4
5
// 插入 meta 标签
var oMeta = document.createElement('meta');
oMeta.content = 'lss';
oMeta.property = 'al:android:app_name';
document.getElementsByTagName('head')[0].appendChild(oMeta);