gpt4 book ai didi

Javascript 当前 url

转载 作者:行者123 更新时间:2023-11-30 06:58:18 31 4
gpt4 key购买 nike

我正在使用 javascript。如何获取当前 URL 的路径并将其分配给我的代码?这是我的代码:

$(document).ready(function() {
$(".share").hideshare({
link: "current_url",
position: "top"
});
});

最佳答案

尝试window.location.href

$(document).ready(function() {
$(".share").hideshare({
link: window.location.href,
position: "top"
});
});

关于Javascript 当前 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36687034/

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