敬請考慮下面的代碼:爲什麼html元刷新重定向不能在提示頁面上工作?
<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>
基本上我只能看到提示頁面現在重定向到目的地頁面在4秒...顯示。但它永遠停留在那裏...... Firebug告訴我,meta標籤確實存在於提示頁面中。
有什麼想法?提前感謝!
這是應該做什麼?你打開一個新窗口到不同的頁面,然後試圖添加一個重定向元標記到那個?你爲什麼不做'window.open'? – Jacob
@Jacob:根據客戶的要求,新窗口在重定向到目標頁面之前應該等待4秒鐘,因爲其他一些進程下面的進程大約需要3秒鐘才能完成。我被告知只能專注於實現前端行爲。 –