The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

Fallback on Local jQuery If CDN Fails is ok but how to control de time to wait?

  • # November 16, 2012 at 4:43 pm

    Fallback on Local jQuery If CDN Fails is ok, but how to control the time to wait? How much should we wait before download the local copy of jQuery?

    # November 16, 2012 at 5:57 pm

    I would say immediately, because calling the jQuery’s CDN version is a http request, so if it comes back bad (404), its going to move on to loading the next resource.

    If for some reason you DO? want to wait you could add

    < script src="whatever.js" defer>< /script >

    or for some reason delay loading a script until something else happens, or by a timer.

    defer: Specifies that the script is executed when the page has finished parsing (only for external scripts)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed