Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/qq_34664239/article/details/90637468
General H5 page online If you change the js or css file, you must manually refresh to be updated, and some in the micro-channel QQ or above, refresh does not work, so how to clear the cache it?
The idea is to introduce the first document stamped variable, each time into the page will reload again
How time-stamped it, after the introduction of direct links is not effective plus
Hey, Ado, directly or dynamically add script style tags, add the timestamp or a random number
Unchanged css or js, direct introduction, before the introduction of dynamic - needs updating
- Dynamically add js
<script>
document.write('<script src="js/appVideoDetail.js?' + Math.random() + '"><\/script>');
document.write('<script src="js/appreward.js?' + Math.random() + '"><\/script>');
</script>
- Dynamically add css
<script>
document.write('<link rel="stylesheet" href="css/appvideoDetail.css?' + Math.random() + '">');
</script>