//页面地址:http://localhost/11/account.html
//访问页面后,地址变为:http://localhost/11/account.html?type=banana
console.log(window.location.search); // 空
window.history.pushState('','', window.location.href + '&type=banana');
console.log(window.location.search); //&type=banana

点击浏览器返回按钮,返回的页面地址是:http://localhost/11/account.html

通过这种方式,修改url参数,页面不会被重新加载,可用于分页加载。

相关文章:

  • 2022-12-23
  • 2021-10-06
  • 2021-12-03
  • 2021-10-31
  • 2021-06-29
  • 2022-12-23
  • 2021-05-27
  • 2022-02-11
猜你喜欢
  • 2022-12-23
  • 2021-11-02
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
  • 2021-09-10
相关资源
相似解决方案