在web 开发中,选择列表分类,在中商品, 详情页面后,返回的时候我们想定位到原来选择的分类 就需要借助window.history.replaceState来实现

   function getProductUrl(cid, number) {
            if (history && history.pushState) {
                // 替换当前url,便于返回的时候定位
                window.history.replaceState(null, "", "/xxxx/Index/" + cid);
            }
            window.location.href = '/product/' + number;
        }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-15
  • 2022-12-23
  • 2021-07-17
  • 2022-02-09
猜你喜欢
  • 2021-12-06
  • 2022-12-23
  • 2022-12-23
  • 2021-09-09
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案