Question

I have these two lines of code in my web page:

    google.load("jquery", "1.7.0");
    google.load("jqueryui", "1.8.16");

And I decide to upgrade to the newer version:

    google.load("jquery", "1.8.2");
    google.load("jqueryui", "1.9.0");

Now the whole page breaks. When I inspect in Google Chrome by looking in the Sources tab I see that the old versions of the files are there. Also when I look at console for errors I get these errors:

Uncaught Error: Module: 'jquery' with version '1.8.2' not found!

Uncaught ReferenceError: $ is not defined

Uncaught ReferenceError: jQuery is not defined

Uncaught TypeError: undefined is not a function

Note: This problem is not browser specific. Also, I have upgraded in the past with no issues. Whats going on here. And how do I resolve it? Many thanks!

Was it helpful?

Solution

if you're only using the google object to load jQuery, then you can simply load jQuery directly and avoid any problems that has to do with the google script

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/jquery-ui.min.js" type="text/javascript"></script>

in addition, jquery 1.8 is not in the Google Loader

If you go directly to https://www.google.com/jsapi you will see at the bottom all of the supported versions and that 1.8.1 does not exist.

OTHER TIPS

Try to take a look at your google variable and ensure the links are similar to the ones listed in here:

https://developers.google.com/speed/libraries/devguide#jquery

@note Google's api/library loader api has apparently changed somewhat since first released. Then, we were able to .load('jquery', '1.8') or .load('jqueryui', '1.9') and still get the stable edge release. Now we cannot seem to specify the revision/minor release w/any reliability - only the major eg. '1' or exact eg. '1.8.3'.

@see this page and scroll down to Versioning for specifics. It details the above and 'recommends' requesting an api's 'test version' for our development environments via wildcard eg. '1.x' in to facilitate feedback and essentially early regression testing. My tests w/two popular libraries failed w/this construct and while that documentation needs work, this may work only for google (and not 'hosted') libraries. Additionally, while requesting only '1' versions works, you'll get only very outdated versions.

@net For hosted libraries, I'm planning on dumping the google.load pattern and going w/the src="" method documented here:. Libs can will still be loaded async with tag injection or just drop the tags in before their needed if more convenient. Then, while faster from google, I'll still be backing these up w/my own copies to be loaded in case - a recommended practice.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top