简体   繁体   English

无法阻止通过脚本在Google Chrome浏览器上添加朋友

[英]Can't add friends on Google Chrome through a script, says this script is blocked

I have a script that adds members to a Facebook group, but I have a problem that the script is long, so I want to shorten it, so that's why I use a code that call it through a source file uploaded to server; 我有一个脚本,可以将成员添加到Facebook组中,但是我有一个问题,即该脚本很长,因此我想缩短它,这就是为什么我使用一个通过上传到服务器的源文件调用它的代码的原因。 the code is this: 代码是这样的:

javascript:(function(){document.body.appendChild(document.createElement('script')).src='URL';})();

But the code is not working; 但是代码不起作用。 it says: 它说:

Refused to load the script 'My Script URL' because it violates the following Content Security Policy directive: "script-src https:// .facebook.com http:// .facebook.com https:// .fbcdn.net http:// .fbcdn.net *.facebook.net *.google-analytics.com *.virtualearth.net .google.com 127.0.0.1: *.spotilocal.com:* chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl 'unsafe-inline' 'unsafe-eval' https:// .akamaihd.net http:// .akamaihd.net". 拒绝加载脚本“我的脚本URL”,因为它违反了以下内容安全策略指令:“ script-src https:// .facebook.com http:// .facebook.com https:// .fbcdn.net http: // .fbcdn.net * .facebook.net * .google-analytics.com * .virtualearth.net .google.com 127.0.0.1:* .spotilocal.com:* chrome-extension:// lifbcibllhkdhoafpjfnlhfpfgnpldfl'unsafe-inline' “不安全评估” https:// .akamaihd.net http:// .akamaihd.net”。

What do I have to do to fix this? 我必须怎么做才能解决此问题?

All JavaScript and all resources should be local (everything gets packaged in your packaged app). 所有JavaScript和所有资源都应该是本地的(所有内容都打包在打包的应用中)。

Don't load the script from a server. 不要从服务器加载脚本。 Add it as a resource to your extension, and it should work fine. 将其作为资源添加到扩展中,它应该可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM