user2871190
user2871190

Reputation: 251

Load page not from cache

I created a guestbook using php. When I save an entry in the guestbook and the user gets a success message with a link "Back to guestbook". But if I click on the link, it doesn't load the new entry. How can I force to reload the page?

I tried location.reload(); but if I use that, the page doesn't stop to load.

Can anybody help me?

Shivan

Upvotes: 0

Views: 41

Answers (1)

Johann Bauer
Johann Bauer

Reputation: 2606

You need to reset the caching headers for that files:

header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Last-Modified: Tue, 15 Nov 1794 12:45:26 GMT");

Make sure your webserver is not overwriting the caching headers for that files.

You might also want to check why the webserver wants the browser to store dynamic content in the cache (eg. why it caches .php-files).

Upvotes: 1

Related Questions