Pure static page, how to more elegantly strong brush

does not use any build tools, backend language
pure HTML page, how to update users automatically after each update upload

1: manually stamp?

Jan.08,2022

I have had this idea before. If you want to add a timestamp to pure html, you can only dynamically load files through javascript, for example (the following syntax is incorrect, but it is rare to think about it, just refer to it)

append('<link rel="stylesheet" href="a.css?_='+ (+new Date()) +'">')

the first thing I need to say before answering this question is the HTML page. Why is it that after each update upload, the user visits why it is not your latest upload

because the browser has a caching mechanism, the css,js and other css,js of the page will be cached automatically after the first browse

so the solutions to this problem are as follows (there should be a lot of ways, and these are the two that come to mind at present)

  1. meta refer to the original
  <META HTTP-EQUIV="pragma" CONTENT="no-cache"><!--  --> 
        <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache"><!--  --> 
        <META HTTP-EQUIV="expires" CONTENT="0"><!-- ; -->
  1. add a random string that follows the path of your src (or link) so that each time the submitted string changes with the new submission string, the browser will reload
if the string changes and the browser considers it to be a new file.

<script type=" text/javascript" src=" /js/test.js?+Math.random()"></script> 

it's best to use a build tool, which is more convenient, or backstage. Pure html can only load css,js dynamically, load css and js, in js and add a timeline as the logo!


< script type= "text/javascript" >

$.getScript ("test.js?v=" + Math.random (), function () {

)
$.getScript("test2.js?v="+Math.random());

});
< / script >

the method currently adopted by the subject

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36293-2bfe5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36293-2bfe5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?