Rummy
Rummy

Reputation: 139

HTML5 Offline - how to prevent browser from using cached page?

I work on a web application in ASP.NET and HTML5. I have a simple page Default.aspx. In its Page_Load handler I call 'Response.Redirect("xxx.aspx"). I also defined a manifest file, Default.appcache as I want my application to work offline (in such case I javascript methods are used for redirection). Browser cached the page as expected but a problem occured - even though server is online, browser uses the cached page. When user enters Default.aspx no call is sent to server. How can I prevent this behavior? I would like the browser to send a normal request to IIS if it is online and use cached page only when server doesn't respond. I would be grateful for all suggestions.

Upvotes: 1

Views: 583

Answers (1)

robertc
robertc

Reputation: 75777

You can't, pages in the cache are always served from the cache. The only way to update them is update the manifest and force new versions to be downloaded.

If you want one page to be served when online and a different one when offline then you should investigate the FALLBACK section of the manifest. Note that the page which references the manifest is always cached, so you need to set the fallback up on a different pair of pages.

Upvotes: 1

Related Questions