|
/

chrome插件中引入友盟统计应该怎么做

M明明
发布于 5 年前
5229
网站统计 U-Web

chrome插件中引入友盟统计应该怎么做

5个回答
 
5 年前

 
5 年前

Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem:". Either the 'unsafe-inline' keyword, a hash ('sha256-n6jZNaU0S81HZ6+zC1okOcR/cqyhPK8Hl3lY+hP/5G4='), or a nonce ('nonce-...') is required to enable inline execution

 
5 年前

第一步:找到原js代码,比如如下:

<script src="https://w.cnzz.com/c.php?id=1258498910&l=2" charset="gb2312"></script>

第二步:把原代码替换成如下片段,然后上传服务器:

<script>

(function() {

var el = document.createElement('script')

el.type = 'text/javascript';

el.charset = 'utf-8';

el.async = true;

var ref = document.getElementsByTagName('script')[0];

ref.parentNode.insertBefore(el, ref);

el.src = 'https://w.cnzz.com/c.php?id=XXXXXXXX&async=1';

})();

</script>

 
5 年前

你这边看看这个是否对你有启发https://developer.umeng.com/docs/67963/detail/68646

Loading ...
登录社区,分享你的经验