Linked Questions
99 questions linked to/from Best way to use Google's hosted jQuery, but fall back to my hosted library on Google fail
165 votes
10 answers
104k views
How to load local script files as fallback in cases where CDN are blocked/unavailable? [duplicate]
I’m using a CDN for the following javascript: https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js http://ajax....
37 votes
3 answers
78k views
jquery ui - how to use google CDN [duplicate]
I want to use Google CDN for jQuery and jQuery UI.. I'm using the answer from here for jQuery. Best way to use Google's hosted jQuery, but fall back to my hosted library on Google fail but i don'...
7 votes
6 answers
8k views
jquery from cdn [duplicate]
How do i load the following in cdn and if they fail i would wnat my local file to load if this fails Google's CDN : jquery.min.js and jquery-ui.min.js. Microsoft's CDN : jQuery.Validate.min.js
0 votes
3 answers
3k views
using cdn and same js file in local repository as fallback will download the file twice or not? [duplicate]
I am using a js file and it is available in cdn. I also have the same js file in my project as fallback. <script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.3.1/js/swiper.min.js"></...
5 votes
1 answer
2k views
Implementing fallback from Google AJAX Libraries API to local jQuery [duplicate]
After looking up the advantages and disadvantages of using Google's AJAX Libraries API instead of using jQuery locally, I saw that someone wrote in an answer (here on Stack Overflow, of course) that ...
1 vote
2 answers
1k views
Loading if Jquery if it failed to load [duplicate]
I am trying to load jquery on to a page that may or may not have jquery. I simply use the typeof to determine if it is loaded. My problem is that I want to check and see if it has been loaded after I ...
3 votes
1 answer
1k views
How to Use Multiple CDN for Library Scripts? [duplicate]
I want to use both "Google Hosted Libraries" and "Microsoft Ajax Content Delivery Network" for library scripts like jQuery, so that even if one fails to load (e.g. Google), another one is loaded, and ...
1 vote
1 answer
827 views
what if google.load fails? [duplicate]
Curious if there was a simple way to have a fail-safe on google.load() The likely hood that google can't deliver the file but I can is pretty slim but I thought it might be interesting to have my own ...
1 vote
0 answers
387 views
Why use document.write to set a Javascript reference? [duplicate]
I'm trying to learn Bootstrap and I was studying this example. I noticed that they include the Jquery library and other scripts at the bottom of the markup just before the end of the body-- this part ...
0 votes
1 answer
167 views
Why are there 2 jQuery libraries [duplicate]
I am new working with Bootstrap v4 and in the footer i see that there are 2 jQuery Scripts. One from a cdn what i understand and one local. What does this line exactly mean: <script>window....
0 votes
0 answers
90 views
How to include jquery online version, or fall back to offline if not available [duplicate]
On my site I have included the google version of jquery like so: <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> But of course this fails when I ...
6380 votes
72 answers
4.5m views
How do I include a JavaScript file in another JavaScript file?
How do I include a JavaScript file inside another JavaScript file, similar to @import in CSS?
1070 votes
15 answers
1.4m views
How to check a not-defined variable in JavaScript
I wanted to check whether the variable is defined or not. For example, the following throws a not-defined error alert( x ); How can I catch this error?
101 votes
13 answers
244k views
Verify External Script Is Loaded
I'm creating a jquery plugin and I want to verify an external script is loaded. This is for an internal web app and I can keep the script name/location consistent(mysscript.js). This is also an ajaxy ...
87 votes
9 answers
48k views
Benefits vs. Pitfalls of hosting jQuery locally [closed]
We're currently pulling jQuery and jQueryUI (and jQueryUI CSS) libraries from the google CDN. I like this because I can call google.load("jquery", "1"); and the latest jQuery 1.x.x will be used. Now ...