簡體   English   中英

從JS無法在Firefox中刷新HTML中的元標記的內容更改

[英]Refresh meta tag's content change in html from js not working in firefox

我正在修改元刷新標簽的內容,但是當頁面刷新時,它不會在新的網址上重新分配。

<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<meta name="refreshMeta" http-equiv="refresh" content="5;url=new1.html">

<script>
    $('meta[name=refreshMeta]').attr('content','5;url=new2.html');
    </script>
</head>
<body>
Page refresh in every 5 seconds.
</body>
</html>

我可以看到控制台中的內容已更改,但是頁面刷新時顯示的是new1.html而不是new2.html(在chrome中工作正常,但在Firefox中存在問題)。

請建議我如何使用jquery覆蓋刷新meta標簽的內容。

提前致謝

使用windows.location從頁面重定向到另一個頁面,使用超時功能實現5秒的延遲

window.location = "new2.html";

檢查您的文檔類型

以下一項將解決您的問題

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3. org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM