Google Chrome: refusal to execute Inline script

In light of the change in the Chrome content security policy, I moved the entire script to separate files and referenced them in the html pages (background and popup) for my chrome extension. But I still get the following message

Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' chrome-extension-resource:". 

This is my reference page.

 <html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="background.js"></script> </head> <!--<body onload = "Load();">--> <body> </body> </html> 

You see that there is no built-in js, but the error message is before it. What is the problem with my code and how to fix it?

Note: I am using manifest version 2 and chrome version 21.0.1180.89

thanks

+4
source share
2 answers

As in the previous answer, when you update the extension for the manifest version 2, the extension code and the code of the mentioned libraries must be compatible with CSP.

Updating your jquery library should be enough. JQuery supports CSP with this error: http://bugs.jquery.com/ticket/11249

+4
source

The problem was resolved by updating jquery.js from version 1.4 to 1.7

+2
source

Source: https://habr.com/ru/post/1434782/


All Articles