gpt4 book ai didi

javascript - 如何获取应用程序的 url?

转载 作者:行者123 更新时间:2023-12-03 05:11:23 26 4
gpt4 key购买 nike

嗨,我有一个更改密码页面,重置密码后它应该重定向到主页。 Thia 是我的更改密码页面的 URL。

https://localhost:9003/store/change-password?code=0a05a6d6-2298-4b62-9687-7deae15951e4

我在 javascript 中使用了这个。

var url = window.location.href;

我只想要这么多网址“https://localhost:9003/store”我怎样才能得到它?

问候,普里扬卡

最佳答案

var url = window.location.origin + (window.location.pathname.indexOf("/")>=0 ? "/" + window.location.pathname.split("/")[1] : "");
alert(url);

关于javascript - 如何获取应用程序的 url?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41802894/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com