元刷新标签(零延迟)是否等待页面完成加载?
元刷新标记(延迟为 0)是否等待页面的所有组件加载\所有脚本完成执行后再执行重定向?
我在 HTML 文档的头部有以下页面标签:
<meta http-equiv="refresh" content="0;url=http://example.com/">
HTML 文档包含其他内容,例如链接到远程 Javascript(例如 Google Analytics)的脚本标签,以及执行 AJAX 请求的 Javascript 代码。
我可以依靠一切来运行吗?或者浏览器可能由于重定向而中途取消下载脚本\执行AJAX\运行脚本?
(我知道使用 Javascript 而不是 Meta 标签实现的选项,想了解 Meta 标签)
Does the Meta Refresh tag (with a delay of 0) wait for all components of page to load \ all scripts to finish executing before performing redirect?
I have the following page tag in the HTML document's head:
<meta http-equiv="refresh" content="0;url=http://example.com/">
the HTML document contains other stuff such as script tags linking to remote Javascript (e.g. Google Analytics), and Javascript code that performs AJAX request.
Can I count on everything to get run? Or may the browser cancel downloading scripts \ performing AJAX \ running scripts mid-way due to a redirect?
(am aware of the option of implementing with Javascript instead of Meta tag, would like to know about Meta tag)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“我能指望一切都能跑起来吗?” - 否
它取决于上下文,即页面的组成方式以及您正在谈论的用户代理。这不是万无一失的。
为什么不使用 Response.Redirect (.NET) 或 header("Location:"); 在服务器端进行重定向? (PHP)?
"Can I count on everything to get run?" - No
It is context dependent, i.e how the page is composed and which user agent you are talking about. It's not fool proof.
Why not do the redirect server-side using Response.Redirect (.NET) or header("Location:"); (PHP)?