First Step: Load JQuery From Google
The very first thing I do is to include jQuery from google’s code base using the following tag:
This will retrieve the latest version (1.3.2) from Google with the proper compression and cache response I like.
However, this sometimes was failing - well according to my error reporting script. What to do?
Test for a successful load of jQuery
Since the SCRIPT tag does not have an
I’ll jump ahead one more step though before code.
If no jQuery found, load it dynamically
If the jQuery object is not found, a new script element is created dynamically. The source is pointed to my local version of the script. Finally, it is appended to the head. Hopefully this will load the jquery. If it fails here, well then - the client has some issues!
In this case, the path
Before this fix, I saw a failed jQuery load about once a day. I have not seen a single one yet. I have yet to see this error reported. If anyone finds a better way to do this, please let me know!