Auto Post Fb | how to blend image in gimp | javascript get browser version | php gmt -7 | Using cookies in php
 


 

Preventing JS or CSS Caching on Web Applications



It is very important for dynamic web applications, any js and css changes to become available to user (without need to refresh - reload browser page).

Instead of

<script type="text/javascript" src="index.js"></script>

use:

<script type="text/javascript" src="index.js?version=1"></script>

Everytime you modify JS file, use next version num (actually, you can use any other string, but ?version=n is more nice). So, you force user browser to retreive JS in case it is changed.

The same method can be applied for CSS.

Hope to find it helpful. Your comments are welcomed!

Εγγραφή!
Sign-up for our free email newsletter. Get updates when new tutorials and tips are published. You can unsubscribe anytime with a click.

Your comments are welcomed!

This site actively encourages commenting on any post. Comments are not pre-moderated, but this community does not tolerate direct or indirect attacks, name-calling or insults. Please, read terms of use and Comment Policy at privacy policy.

More tips