Reputation: 23563
Im loading a javascript file from a CDN. Im developing locally and I noticed that when my internet went down and the remote file wasn't available, the entire page failed to load.
Is there a way of linking to a remote file, but making it so the rest of the page will load if this file is missing? Thanks
Upvotes: 0
Views: 337
Reputation:
You can also try placing the JavaScript file at the bottom of the page or use conditional includes.
if(Request.IsLocal)
{
// Use local files
}
else
{
// Use CDN files
}
Upvotes: 0
Reputation: 15735
You could use asynchronous loading. That way unavailable files will not block loading the rest of the page but you could of course still encounter unexpected behavior if some necessary script files fail to load.
Upvotes: 1