0

can I somehow enforce a browser-reload? I'm already using this:

header("Expires: Mon, 2 Jan 2012 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");

But if I change for example JavaScript-Code in my website, the visitors of my website have to manually reload the page for an updated javascript. Do I have to send headers in the .js files also? How to do this?

4

1 回答 1

1

Browsers should probably be better about this, but change this:

<script src="file.js">

to this:

<script src="file.js?last-modified-time-goes-here">

This will load the latest JS file each time and you don't have to change the filename!

于 2012-11-16T07:55:55.037 回答