Is there a way to use a CDN (for jQuery) and have an offline Web app (via HTML5 manifests)?

后端 未结 3 404
后悔当初
后悔当初 2021-01-31 05:59

I\'m beginning to look at HTML5s ability to allow for offline Web applications.

A while back I found that using a CDN worked well for my applications, so I\'ve been stic

3条回答
  •  星月不相逢
    2021-01-31 06:40

    the path of checking if online jquery exists and if not loading from local was answered here: How to load local script files as fallback in cases where CDN are blocked/unavailable?

    where there is a discussion and a couple of different approaches

    personally I like the html5boilerplate approach:

    
    
    

    you can check if the browser supports offline caching with modernizer http://www.modernizr.com/ the modernizer 2.0 version supports conditional loading , so you can use it to detect and load the needed resource with the following script (taken from diveintohtml5):

        if (Modernizr.applicationcache) {
      // window.applicationCache is available!
    } else {
      // no native support for offline :(
      // maybe try Gears or another third-party solution
    }
    

    but as I said before, I prefer the html5boilerplate method

提交回复
热议问题