Search code examples
c#jqueryasp.netoperamvp

Opera back-button cache functionality


I have some jQuery which modifies elements on the page after the user performs an action. These are persisted server-side so it all looks nice and fluid for the user.

When the user clicks off-site and then hits the back button all browsers except Opera re-request the page, hence the changes still appear for the user. With Opera however the site returns to it's pre-Jquery state (since it didn't request the page from the server).

I could do something nasty like check the browser and refresh if Opera, but obviously this is not ideal.

Any ideas of a better method to solve this?


Solution

  • Not one to answer my own question but it appears the following solves my problem:

    history.navigationMode = 'fast';
    

    Setting this means that pages will be loaded in the exact state that they were in when you left the page, which is basically what I was looking for. It appears to be an Opera only setting, although it appears to be only Opera which acts differently.

    I found the information here.