Click here to Skip to main content
15,358,603 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi,

I am trying to use Google APIs Client Library to develop a Chrome Extension. The problems is that I cannot inject this script in background page to access the API:
JavaScript
<script src="https://apis.google.com/js/client.js?onload=handleClientLoad"></script>

Debug in Chrome throw an error:
Refused to load the script 'https://apis.google.com/js/client.js?onload=handleClientLoad' because it violates the following Content Security Policy directive: "script-src 'self' chrome-extension-resource:".

which is mentioned in this page[^]. Therefore, only local script and and object resources are loaded.
I tried to download the client.js file and include it in my package but it didn't help at all.
Is there any solution for this problem?
I am using manifest version 2.
Posted
Updated 6-Aug-12 18:45pm
v2

1 solution

add this to your manifest file , it will work fine
"content_security_policy": "script-src 'self' https://apis.google.com; object-src 'self'"
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900