How can I force clients to refresh JavaScript files?

后端 未结 26 2204
旧时难觅i
旧时难觅i 2020-11-22 03:40

We are currently working in a private beta and so are still in the process of making fairly rapid changes, although obviously as usage is starting to ramp up, we will be slo

相关标签:
26条回答
  • 2020-11-22 04:31

    location.reload(true);

    see https://www.w3schools.com/jsref/met_loc_reload.asp

    I dynamically call this line of code in order to ensure that javascript has been re-retrieved from the web server instead of from the browser's cache in order to escape this problem.

    0 讨论(0)
  • 2020-11-22 04:33

    Below worked for me:

    <head>
    <meta charset="UTF-8">
    <meta http-equiv="cache-control" content="no-cache, must-revalidate, post-check=0, pre-check=0" />
    <meta http-equiv="cache-control" content="max-age=0" />
    <meta http-equiv="expires" content="0" />
    <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
    <meta http-equiv="pragma" content="no-cache" />
    </head>
    
    0 讨论(0)
提交回复
热议问题