-2

Possible Duplicate:
HTML 5 offline caching

I'm coming from a desktop app world, but getting into javascript and the web world more. The more I work with javascript the more I like it's functionality. I hate page reloads and use ajax for any communication I need outside of the initial page load to the site. My app to this point is 100% client side and uses local storage to store it's information with the ability to upload to a server side DB on the users request & when internet access is available.

The "click once" reference in the title is the sort of functionality I'm wanting to get out of this app. Since the app is 100% client side it needs to be available off-line. Is there a way I can treat this app as sort of a "click once" style, where the first time you access the web page it'll download the page. Then each time you try to access the page from then on is able to detect if the user has a fast enough internet connection (this check needs to be fast obviously), and if so somehow check on the server if any changes to the app were made (no need to redownload the entire page at this point, just a simple check of difference with a small yes/no response). If no changes just open the local cache of the site. If changes redownload the page and now make it the new local cache.

Is there a way to get this functionality?

Community
  • 1
  • 1
user441521
  • 6,942
  • 23
  • 88
  • 160
  • Google "application cache" - it's possible but it's fraught with peril – Pointy Nov 29 '12 at 14:17
  • Are you trying to reinvent HTML5 offline apps: http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html – epascarello Nov 29 '12 at 14:17
  • 1
    Check this question: http://stackoverflow.com/questions/1207150/html-5-offline-caching – fableal Nov 29 '12 at 14:18
  • @epascarello If the user has internet access will it always redownload the page details or does it only download if the page is different than the one in their cache? – user441521 Nov 29 '12 at 14:21

1 Answers1

2

This may be what you are looking for.

edit for 2018: use this instead https://en.wikipedia.org/wiki/Web_worker

user1034533
  • 1,054
  • 9
  • 9
  • Seems interesting that it updates from the web IF the cache manifest has changed. What's the flow on how it determines that? I ask that because if I update an existing javascript file in my app that wouldn't change the cache manifest file, but I would want the local app updated to reflect this code change. – user441521 Nov 29 '12 at 14:27