Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 sticking with them, mostly just for jQuery.

However, it doesn't appear that manifest files allows cross-domain resources to be cached.

At this point I've been using the catch-all manifest as described by the relevant Dive Into HTML5 tutorial. My jQuery is pulled in similar to what's defined in the HTML5 Boilerplate.

I'd like to be able to continue to serve jQuery from a CDN for online users, but perhaps have a local copy cached for offline access.

Is it worth trying to pursue this route, or should I just switch over to just serving jQuery from my site, for all requests?

Thanks.

like image 223
James Skemp Avatar asked Mar 10 '11 19:03

James Skemp


People also ask

What is CDN for jQuery?

jQuery CDN is a quick and concise JavaScript library that simplifies event handling, animation, AJAX interactions, and HTML document traversing for fast website development. jQuery UI CDN simplifies the client-side scripting of HTML; therefore, it simplifies the development of Web 2.0 applications.


1 Answers

Actually, you can write your manifest that has a link to your jQuery CDN. Just like my app.manifest:

CACHE MANIFEST
# 2012-01-20:v4

http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js

That is HTML segment:

<html manifest="app.manifest">
<head>
    ....
</head>
<body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    ....
</body>
</html>

It works to me.

like image 185
KimKha Avatar answered Sep 28 '22 18:09

KimKha