I have web-site, everytime I update the news or anything on the site like adding pictures or changing pictures via FTP and visit it in Firefox or INternetexplorer I have to hit Refresh to view the Updates. Why is this? Can I fix it so it shows updates everytime users visit?
09-03-2006, 03:52 AM
This is because once your browser downloads the page, it breaks contact with the server. Refreshing makes your browser download the pictures again, and then it gets the new version.
To make your page update automatically, you may want to look into AJAX (http://www.w3schools.com/ajax/default.asp) or the setInterval() function. e.g. The JS code setInterval("location.reload();",3000); would make your page refresh every 3 seconds; however, that updates the whole page, so your code will probably have to be a bit more complex, so you are updating only the images,news,etc.
If it's news that needs updating, I would recommend AJAX.
09-03-2006, 03:58 AM
I suggest you change the HTTP headers that control how browsers will cache your page (http://www.google.com/search?q=HTTP+headers+cache) instead of resorting to AJAX which would be overkill for this.