元刷新与 #-anchor 进入循环
以下构造
<meta http-equiv="refresh" content="3;url=#scroll" />
从 http://localhost/
访问
时,会将所有浏览器重定向到 http://localhost/#scroll
,并且不会按预期发生进一步的重定向。然而,当目标 url 使用相同的构造时,http://localhost/#scroll
,firefox 和 opera 会每 3 秒刷新一次页面,向服务器发出 http 请求,无论事实上,重定向的 url 已经到达。
对此有任何解释和/或修复吗?
请注意可能的解决方案:JavaScript 在这种特定情况下不可用。
The following construct,
<meta http-equiv="refresh" content="3;url=#scroll" />
when accessed from http://localhost/
, redirects all browsers to http://localhost/#scroll
, and no further redirecting occurs as expected.
However, when the very same construct is used from the target url, http://localhost/#scroll
, firefox and opera keep refreshing the page every 3 seconds, making http requests to the server, regardless of the fact that the url for redirect has already been reached.
Is there any explanation and/or fix for this?
NB for possible solutions: JavaScript is unavailable in this specific situation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您感兴趣,Firefox 所做的就是它通常将元刷新视为强制新文档加载。但如果 URI 在 15 秒内发生变化,则会将其更改为替换。然后稍后这会让锚点滚动检查成功。
In case you're interested, what Firefox is doing is that it normally treats meta refresh as a forced new document load. But in the case where the URI changes within 15 seconds, it changes it to a replace. And then later on this lets the anchor scroll check succeed.
我不认为元刷新是为了跳转到锚点而设计的。
如果你不能使用 JavaScript,你就不能自动化它。
I don't think meta refresh was designed to jump to anchors.
If you can't use JavaScript, you can't automate it.