Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

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

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #40844
    nagarweb
    Member

    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?

    #114591
    JohnMotylJr
    Participant

    @nagarweb
    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)
  • The forum ‘JavaScript’ is closed to new topics and replies.