I have an error:
Refuse to run the inline script because it violates the following content security Policy directive: "script-src 'self' chrome-extension-resource:" . Either the keyword 'unsafe-inline' , or hash ( 'sha256-...' ), or unce ( 'nonce-...' ) is required to enable inline execution.
chrome extension: //ldbpohccneabbobcklhiakmbhoblcpof/popup.html: 1
Refused to evaluate the string as JavaScript because 'unsafe-eval' not an authorized script source in the following Content Security Policy directive: "script-src 'self' chrome-extension-resource:" .
code popup.js
$(document).ready(function() { $.getJSON('http://.......alerts.json', function(data) { alert('HELLO'); }); });
manifest:
{ "manifest_version": 2, "name": "Alert", "description": "This extension for .", "version": "2.0", "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'", "permissions": [ "http://www.......il/" ], "browser_action": { "default_icon": "icon.png", "default_popup": "popup.html" }, "content_scripts": [ { "js": [ "jquery.min.js", "popup.js" ], "matches": [ "http://*/*", "https://*/*"] }] }
Popup:
<!doctype html> <html> <head> <title>Getting Started Extension Popup</title> <style> body { min-width: 357px; overflow-x: hidden; } img { margin: 5px; border: 2px solid black; vertical-align: middle; width: 75px; height: 75px; } </style> <head> <script src='jquery.min.js'></script> <script src='popup.js'></script> </head> </head> <body> </body> </html>
json javascript google-chrome-extension content-security-policy
Vitaly Menchikovsky Jul 17 '14 at 8:37 2014-07-17 08:37
source share