gpt4 book ai didi

javascript - 为什么 html 元刷新重定向在提示页面上不起作用?

转载 作者:行者123 更新时间:2023-11-30 10:48:31 25 4
gpt4 key购买 nike

请考虑以下代码:

<html>
<head>
<title>This is the from page</title>
</head>
<body>
<script type='text/javascript'>
function redirect(destination)
{
newWindow = window.open(destination, "_blank", "width=790,height=520");
newWindow.document.write("<meta http-equiv='refresh' content='4;url=" + destination + "'>");
newWindow.document.write("<h1>Now redirecting to destination page in 4 seconds...</h1>");
}

redirect("./to.html");
</script>
</body>

基本上我只能看到Now redirecting to destination page in 4 seconds...的提示页面。但它永远卡在那里......Firebug 告诉我元标记确实存在于提示页面中。

有什么想法吗?非常感谢!

最佳答案

    function redirect(destination)
{
setTimeout(function(){window.location = destination;},4000);
}

关于javascript - 为什么 html 元刷新重定向在提示页面上不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6920258/

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