Cause: The business wants a fixed QR code to jump to different pages each week, I use JS to write a jump, but found to be cached, although the cache is not clear how long, but the cache is very uncomfortable, does not meet the business real-time change this QR code jump page needs.
After: Since the page is cached, then at the top of the page meta says do not cache chant, the head tag add the following code:
<meta http-equiv= "Pragma" content= "No-cache" >
<meta http-equiv= "Cache-control" content= "No-cache" >
<meta http-equiv= "Expires" content= "0" >
The result you understand, invalid! Very strange, "window.location.href=" Https://XXXXX ";" as soon as this code appears in the page, the jump is cached , and if this is removed, the HTML like alert and other pages will not be cached.
Solution: Just when I worry, think of the previous solution to the JS cache method, is to add a random number after the reference URL. This gives me an inspiration, since the browser caches the page's jump code, then I will do a page jump, and add this parameter, so that the loaded jump page will not be cached again. Can be used after testing.
PS: Although the HTML document is written in meta-settings can prevent page caching, but this is only a standard, how to implement or to see the browser's own, I am using the Chrome browser, it is estimated to "window.location.href=" Https://XXXXX ";" has been optimized, as long as this statement appears will cache the page (I guess). If you have more information about this problem, you are welcome to communicate.
Work Pit record: JavaScript jump is cached