How to update programatically a page server side when using html 5 cache manifest without changing cache manifest?

StackOverflow https://stackoverflow.com/questions/13495917

Question

I have an application who has different interface for different role

I want to cache the application and update it if the user change his role

example :
Role user --> www.sample.com/index.jsp (user version)
Role admin --> www.sample.com/index.jsp (admin version)

Case 1 : if the user1 access to www.sample.com/index.jsp with Role User and his previous connection was with the Role User ---> use the cached version

Case 2 : if the user1 access to www.sample.com/index.jsp with Role Admin and his previous connection was with the Role User ---> update cache

I am using jquery mobile, html 5 , Java/Spring

Was it helpful?

Solution

You can't. To update the cache, the manifest MUST be changed, at least one byte somewhere in the file. Once the site is cached, the client only ever reloads the manifest itself to check if it has changed. If it hasn't, the cached data is used. If it has changed, all ressources listed under "CACHE" are loaded and cached.

To do what you plan you will most likely need a dynamic manifest, so that you can send it back slightly different, depending on whether a user an admin requests it. A possible way to dynamically change the manifest depending on admin or user would be to have two seperate manifest files on the serverside. They would be requested over a single URL. The server checks if the user is an admin or not (however you do that) and returns the correct manifest file. This way the cache would only be reloaded if a user changes from admin to client or the other way around.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top