How can I force [removed] to make an HTTP request instead of using the cache?

后端 未结 5 1720
难免孤独
难免孤独 2021-01-11 17:18

In my web application I am setting window.location to navigate to a different page, but for some reason Firefox shows an old version of that page.

Usin

5条回答
  •  伪装坚强ぢ
    2021-01-11 17:52

    You could just add a random parameter to the page URL in order to have the browser issue a new request.

    So instead of using

     window.location = "my.url/index.html";
    

    use

     window.location = "my.url/index.html?nocache=" + (new Date()).getTime();
    

提交回复
热议问题