Re: Reloading changes JS files?

From: Date: Thu, 29 May 2008 01:58:12 +0000
Subject: Re: Reloading changes JS files?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-274792@lists.php.net to get a copy of this message
Skip Evans wrote:
Hey all, I don't know if it's practical to change the name of the file when they are updated, but another thing I found along similar lines reading up on this was something like this was: ajax/players.js?version=21 Would that also do it? Not sure what the server is sending for EXPIRES, looking up how to determine that now. Skip dhorton@iprimus.com.au wrote:
Use a version numbered name for the js? e.g. ajax/players21.js What does your server send for the EXPIRES for js files? i.e. what have you told the browser to cache. What is the browser cache policy? David
I've never seen the version number actually used except when you take into account that the number MIGHT change which means that they should get a new file when the server loads the page. Other then that you either have to rely on the client's browser to listen to your "expires" setting, or hope they don't have their browser over-ride yours. The best thing I can recommend is having the .js code directly coded into the page as you server it instead of linking in the files. Or write code that is compatible no matter which version of your JS they have. IE: if you have all of your menus and such in JS code, rethink how you coded. Also remember, not everyone runs JS or JAVA, some of us actually disable it as a matter of course. Which means your site breaks US federal guidelines when it becomes unusable to those who don't have flash/js/java/shockwave. Wolf

« previous php.general (#274792) next »