I have a page that pulls an external JavaScript file, which then generates some content dynamically into that page (basically inserts some DIVs and a Flash object).
When ever the user navigates away from this page and then pushes the 'back' button, Safari and Firefox display the generated content, but IE 8 does not.
What is the best practice for IE to retain dynamic content in history? Or do I have to listen for some specific event and then restart my JavaScript?
BTW, I have jQuery in place, so relevant plugin suggestions are also welcome.
EDIT: here is link to demo:
http://mmstest.eenet.ee/embed/281
If you click the Google link at the bottom and then go Back, Safari and FF will show you the video again, IE8 does not.
I did a quick test using the IE Developer toolbar- I clicked back and nothing happened as you mentioned. I then tried again but before clicking back I cleared my cache, and when I went back the video showed up.
Try ensuring you force IE to clear the browser cache and your video should load even when clicking on the back page.
---- EDIT ADDED AFTER CACHING CONVERSATION ---
This should not affect the performance of your web application the client browser gains from caching, since you would send back headers to expire/disable the cache only for the page that fires off the JS to embed the video. Everything else- the JS scripts, the graphic/images, and event the video- would still be cached by the client.
---- EDIT: UPDATED TO INCLUDE FULL SOLUTION FROM COMMENTS ---
To disable caching of included JavaScript files one solution is to just append random number in query parameter to the URL, so that browser will not cache the result.
<script src="jquery.js?t=<?PHP echo rand() ?>">
This avoids the need to modify webserver settings to disable caching static JavaScript files system-wide.
You should look into using a history plugin to get consistent results with dynamic content.
Here is a thread with some plugins jquery history plugin