4
votes

In light of change in chrome's content security policy, I have moved all the script in separate files and referencing them in 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 background 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 there is no inline js but the error message is till there. What's the problem with my code and how can I fix it?

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

Thanks

2
Without seeing the code in background.js, there's not much to debug here. - Rob W
thanks Rob. Problem solved. Plz see my answer - Muhammad Adeel Zahid

2 Answers

4
votes

As the previous answer suggests when you update your extension to manifest version 2 the code of the extension and the code of the referred libraries have to be CSP compatible.

Updating your jquery library should be enough. Jquery supported CSP with this bug: http://bugs.jquery.com/ticket/11249

2
votes

The problem was solved by upgrading the jquery.js from version 1.4 to 1.7