function wxRefresh() {
var replaceQueryParam = (param, newval, search) => {
var regex = new RegExp('([?;&])' + param + '[^&;]*[;&]?');
var query = search.replace(regex, '$1').replace(/&$/, '');
return (query.length > 2 ? query + '&' : '?') + (newval ? param + '=' + newval : '');
};
window.location.replace(location.protocol +
'//' +
location.host +
location.pathname +
replaceQueryParam('_wxr_', new Date().getTime(), location.search) +
location.hash);
};
// 执行
wxRefresh();
Created
May 2, 2017 14:41
-
-
Save billyma128/c148039cda3585c5af7509a200501c34 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment