gpt4 book ai didi

javascript - window.open 目标 _self v window.location.href?

转载 作者:IT王子 更新时间:2023-10-29 02:56:11 24 4
gpt4 key购买 nike

我需要使用 JavaScript 重定向用户。哪种方法是首选?

window.open("webpage.htm", "_self");

window.location.href = "webpage.htm";

最佳答案

绝对首选第二种方法,因为您没有另一个函数调用的开销:

window.location.href = "webpage.htm";

关于javascript - window.open 目标 _self v window.location.href?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4813879/

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