在URL上设置时间戳

//获取当前的毫秒数
var timestamp =new Date().getTime();

function ntimestamp() {
    return 't=' + new Date().getTime();
}

//在URL上设置时间戳
function setUrlStamp(url) {
    if(url.indexOf("?") != -1) {
      url = url + "&" + ntimestamp();
    } else {
      url = url + "?" + ntimestamp();
    }
    return url;
}

 调用:

   location.href=setUrlStamp("weightInput.html");

原文地址:https://www.cnblogs.com/rockyan/p/8549627.html