元刷新标签(零延迟)是否等待页面完成加载?

发布于 2025-01-01 13:44:32 字数 384 浏览 5 评论 0原文

元刷新标记(延迟为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萌酱 2025-01-08 13:44:32

“我能指望一切都能跑起来吗?” -

它取决于上下文,即页面的组成方式以及您正在谈论的用户代理。这不是万无一失的。

为什么不使用 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)?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文