【发布时间】:2021-09-25 00:45:29
【问题描述】:
我正在尝试从本地删除 #step_4#step_4#step_4
项目链接
https://localhost/test-project/#step_4#step_4#step_4 使用 window.location.href。
我已经完成了下面的代码
var url_id = window.location.href;
var url_id_value = url_id.split('#')[1];
console.log(url_id.split('#')[1]);
但我刚刚在控制台中获得了step_4。
但是我想使用window.location.href 将值https://localhost/test-project/ 存储在变量中,或者有没有其他方法可以将该值存储在变量中?
【问题讨论】: