How can I fix this?
1. Don't wrap script and style contents in HTML comments. <!-- //--> 2. The problem is that the browser still has the previous page loaded in cache, so when you go back, it doesn't trigger any "load" events, it just returns to the last known state. To prevent this, you can define an onunload event handler, which will force the browser to release the cache. Note, only do this on the pages where caching is detrimental to the behavior.