Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to 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:
<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 6-Aug-12 19:42pm
Duy Dam172
Edited 6-Aug-12 19:45pm
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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

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

  Print Answers RSS
0 OriginalGriff 295
1 DamithSL 295
2 Sergey Alexandrovich Kryukov 207
3 Peter Leow 155
4 Afzaal Ahmad Zeeshan 154
0 OriginalGriff 7,460
1 DamithSL 5,519
2 Sergey Alexandrovich Kryukov 4,954
3 Maciej Los 4,936
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web02 | 2.8.141223.1 | Last Updated 25 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100