Click here to Skip to main content
12,356,154 members (70,671 online)
Rate this:
 
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 18:42pm
Duy Dam177
Edited 6-Aug-12 18: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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 25 Feb 2013
Copyright © CodeProject, 1999-2016
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