Content Security Policy: cannot load Google API in Chrome extension

Laurent :

This is relative an Chrome extension. I am trying a simple one which uses the Google Chart API

I have this code in my html document "popup.html", which is loaded on the click on the Icon.

<!doctype html>
<html>
<head>
  <script type="text/javascript" src="js/libs/jquery-1.8.0.min.js"></script>
  <script type="text/javascript" src="js/popup.js"></script>
  <script type="text/javascript" src="http://www.google.com/jsapi?key=xxxxxxxxxxx"></script>

  [...]
</body>
</html>

I get the following message:

Refused to load the script 'http://www.google.com/jsapi?key=xxxxxxxxxxx' because it violates the following Content Security Policy directive: "script-src 'self' chrome-extension-resource:".

I understood it is something relative to permissions, I tried to modify my Manifest file but without success:

{
  [...]
  "manifest_version": 2,
  "permissions": ["http://*.google.com/"],
  "content_security_policy": "script-src 'self' http://www.google.com; object-src 'self'",
}

Any idea?

Some Guy :

Just make it use the https protocol instead. The error you're getting is regarding the Content Security Policy.

See the Relaxing the default policy section of the page. It mentions that you can only whitelist HTTPS, chrome-extension, and chrome-extension-resource.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Refused to load the script because it violates the following Content Security Policy directive

Content Security Policy in Chrome App

Jenkins Content Security Policy

Extension refuses to load the script due to Content Security Policy directive

Google Fonts violates Content Security Policy

Why doesn't Chrome respect my Content Security Policy hashes?

how to fix 'Chrome Content Security Policy Directive' in chrome extension

Chrome Extension - Content Security Policy - executing inline code

Using jQuery in overridden new tab, in Chrome Extension, violates Content Security Policy?

Google Analytics Content Security Policy

Vimeo Content Security Policy error - Refused to load the script

Chrome Extension: Content Security Policy Error

Google fonts blocked by Content Security Policy

Why are scripts refusing to load in Google Analytics Chrome extension when I included the recommended security override?

Content-Security-Policy: Difference between Google Chrome, Firefox, and Microsoft Edge

Refused to load the script because it violates the following Content Security Policy directive: script-src error with ChromeDriver Chrome and Selenium

Refused to load the image 'blob:...' because it violates the following Content Security Policy

Chrome extension Content Security Policy directive error

XSS and Content Security Policy

Does Chrome treat the Content Security Policy HOST as case sensitive?

Chrome extension - load content script on URL updates

Refused to load because it violates Content Security Policy

How to remove unsafe-eval from chrome extension's content_security_policy

GatsbyJS & Content Security Policy

Can't get content_security_policy to work in my extension

How to load css style in firefox and solve Content Security Policy:problem?

Google Maps error on Content Security Policy

Content Security Policy Wildcards?

Refused to load the script : Content-Security-Policy