How to force cache to use javascript and base load script

I have a bookmarklet that continues to use cache versions http://www.imvu-e.com/products/hpv/download/HPV.js . I want him to never cache it and restart it.

This is the hyperlink that I use to save the bookmarklet (which the user drags to the browser toolbar that installs it):

 <a href="javascript:(function(){ c = document.createElement(&quot;script&quot;); c.type = &quot;text/javascript&quot;; c.src = &quot;http://www.imvu-e.com/products/hpv/download/HPV.js&quot;; c.onload = c.onreadystatechange = function() { if ( ! (d = this.readyState) || d == &quot;loaded&quot; || d == &quot;complete&quot;){ document.documentElement.childNodes[0].removeChild(c); version='beta'; } }; document.documentElement.childNodes[0].appendChild(c); })();">Run HPV</a> 
+4
source share
2 answers

Add a useless chain to the end of your URL:

 c.src = "http://www.imvu-e.com/products/hpv/download/HPV.js?" + (new Date).getTime(); 
+15
source

Use jQuery getScript instead of script tag and modifying source code

 <script> $.getScript("JavascriptFileName.js?timestamp=" + new Date().getTime()); </script> 
0
source

Source: https://habr.com/ru/post/1397863/


All Articles