Amg*_*ged 2 javascript google-chrome google-chrome-extension content-security-policy
我正在使用chrome扩展并使用内容脚本在页面上执行此代码
chrome.browserAction.onClicked.addListener(function(tab) {
try{
$('input[type="submit"]').click();
}
catch(err){
($('input[type="button"]').attr('onclick'))(event);
}
});
Run Code Online (Sandbox Code Playgroud)
我收到此错误
"由于Content-Security-Policy拒绝应用内联样式."
manifest.json代码:
{
"name": "sites faxana ads clicking exception",
"version": "1.0",
"background_page": "background.html",
"permissions": [
"tabs", "<all_urls>"
],
"browser_action": {
"default_icon": "icon.png",
"name": "Make this page red"
},
"content_security_policy": "default-src 'none'; script-src 'self'"
}
Run Code Online (Sandbox Code Playgroud)
你可能<style>.selector { ... }</style>
在头脑中使用内联.您的CSP阻止您这样做.相反,使用<link rel...>
.
有关更多信息,请参阅以下主题的好文章:https://mikewest.org/2011/10/secure-chrome-extensions-content-security-policy
归档时间: |
|
查看次数: |
5271 次 |
最近记录: |