How do I Attach or update a timestamp querystring parameter

后端 未结 2 1296
春和景丽
春和景丽 2021-01-17 05:16

I want to attach a timestamp to my querystring in order to ensure that the browser bypasses its cache when I refresh the page via javascript. I need to account for an exist

2条回答
  •  长情又很酷
    2021-01-17 05:54

    var newLocation = window.location.href.replace(/\?.*(ts=\d*)/, "ts=" + new Date().valueOf());
    

提交回复
热议问题