0

The goal is to automate a users workflow, by scraping the current webpage, preparing a structure and returning it in a format with a shortened URL.

The contributions from the stackoverflow community contributed an effective solution needed.

2 Answers2

0

From what I'm reading in the documentation of https://api.jquery.com/jquery.getscript/ the error seems legit.

The callback is fired once the script has been loaded but not necessarily executed.

You should have a look at the documentation regarding proper integration of the javascript library presented across these following links

dev jscript, samples

However I think you could fix your problem by loading the library and providing a callback function reference which will be executed once the library has been loaded and executed.

I think that what you should do is wrap the bits requiring a gapi instance in a callback function, say gapiIsLoaded like so

function gapiIsLoaded() {        

    gapi.client.setApiKey("<API_KEY_HERE>");
    gapi....
}

..and point the getScript function to this URL instead

https://apis.google.com/js/client.js?onload=gapiIsLoaded

Filip
  • 1,214
  • 10
  • 19
0

Filip seems correct. There is already a talk going on for this issue.

jQuery getScript load vs execution

Below onload callback should solve the issue:

https://developers.google.com/api-client-library/javascript/dev/dev_jscript

Nways, I visited the URL you provided, and its just throwing some 404 errors for select.js. Can you please specify where exactly you are getting this error on mentioned webpage?

Community
  • 1
  • 1
  • I haven't tested the solution I've proposed, as you've correctly stated the solution only "seems correct" judging by the documentation I've referenced :) – Filip Sep 18 '15 at 09:28