Adi Mabfalin Adi Mabfalin - 4 years ago 186
Javascript Question

How to Load Google API Javascript Client Library into Chrome App

So it's easy to load javascript client library in HTML. I'm talking about this one:

You just load it using,

<script src="">

Then you can use it..

function checkAuth() {
'client_id': CLIENT_ID,
'scope': SCOPES.join(' '),
'immediate': true
}, handleAuthResult);

function handleAuthResult(authResult) {
var authorizeDiv = document.getElementById('authorize-div');
if (authResult && !authResult.error) {
// Hide auth UI, then load client library. = 'none';
} else {
// Show auth UI, allowing the user to initiate authorization by
// clicking authorize button. = 'inline';

Now, my question:

How do I do this in Chrome App? How do I load the JS client libraries so I can use it in Chrome app.

Answer Source

Figured out a way to do this. Just add the API libraries in your permissions in manifest.json.

"permissions": ["*"]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download