js delete URL parameters without refreshing page All In One

js delete URL parameters without refreshing page All In One

Remove URL parameters without refreshing page

先写后读,读后删除还原

vue router

// 更改 this.$route.query


History API

// delete all params
history.pushState({}, '', window.location.origin + window.location.pathname);

https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState

refs

https://stackoverflow.com/questions/22753052/remove-url-parameters-without-refreshing-page

https://www.cnblogs.com/xgqfrms/p/9138024.html

window.location.search;
'?initFilter=true'

searchParams = new URLSearchParams(window.location.search);
URLSearchParams {}

searchParams.get("initFilter");
'true'



©xgqfrms 2012-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 ️,侵权必究⚠️!


原文地址:https://www.cnblogs.com/xgqfrms/p/15720755.html