我想做类似的事情
location.pathname = "/abc"
location.search = "name=test"
它最终被重定向到/abc
。我希望重定向发生/abc?name=test
只需设置location
(or location.href
):
location = "/abc?name=test";
由于它是相对 URL,因此协议和主机将保持不变。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)