If you use javascript/dhtml to, say, add a text field to a web page. If you then navigate away from this page and back again using the back button the added text field is lost and the web page is back to how it was prior to any dhtml changes.
I assume this is because the browser is using the cached version and not the changed dhtml version.
How can I force the changed web page to be cached so that when returning to the page the dhtml version is the page I see with the added text field?
You can’t. Once the page reloads all original variables are lost. If you want to do this you will need to use one of three possible strategies:
1: Use a frameset and store the field values in variables in a hidden frame and re-populate the fields on returning to the page.
2: Transfer the field values as a string of text as part of the location.href and then reconstruct the fields when you get back to the page.
3: Send the field values as a name/value pairs to a cookie on the client’s computer.
Each method has advantages and disadvantages, but it can be done like this.