Created
January 29, 2016 09:00
-
-
Save satishSKY/3aa35f95647e8105a131 to your computer and use it in GitHub Desktop.
Give dynamic versioning for css and js files by using javascript.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Versioning-of-js-and-css- | |
| Give dynamic versioning for css and js files by using javascript. | |
| var jsVersion = parseInt(Math.random()*1000000000); var script = document.getElementsByTagName('script'); var link = document.getElementsByTagName('link'); for (var int = 0; int < link.length; int++) { link[int].href = link[int].href + "?ver=" + jsVersion; console.log(link[int].href); } | |
| for (var int = 0; int < script.length; int++) { script[int].src = script[int].src + "?ver=" + jsVersion; console.log(script[int].src); } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
done.