http-equiv="refresh" 是否有效?保留引用信息和元数据?
如果我设置这样的页面:
<html><head><meta http-equiv="refresh" content="0;url=http://internic.net/"></head><body></body></html>
执行重定向时浏览器会发送引荐来源网址信息和其他元数据吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在此测试中,Firefox 和 IE 不会,但 Chrome 会发送引荐来源网址(尽管这也不一致),无论它是否发送到同一域。
由于我找不到任何规范来说明什么是标准行为,而且 W3C 通常不鼓励 META 重定向,因此我不确定您是否可以依赖这一点来保持一致。
In testing here, Firefox and IE do not but Chrome does send the referrer (though this is inconsistent as well), regardless of whether it's going to the same domain or not.
Seeing as I can't find any spec stating what should be the standard behavior, and W3C in general discourages a META redirect, I'm not sure you can ever depend on this being consistent.
我对此做了一些额外的测试。我涉及三个 URI(都在同一个域上):
/page.html
它有一个指向元刷新的链接/refresh.html
它使用元刷新来目的地/destination.html
使用 JavaScript 将引荐来源网址写入页面。我在多个浏览器中运行了测试,打开
page.html
并单击链接,然后观察目的地上的引荐来源网址。结果如下:http://example.com/ fresh.html
http://example.com/refresh.html
http://example.com/refresh.html
没有一个浏览器将
http://example.com/page.html
显示为引用网址,就像使用 301 或302 重定向。因此,元刷新可以在某种程度上用来掩盖引荐来源网址:I did some additional testing with this. I had three URIs involved (all on the same domain):
/page.html
which had a link to the meta refresh/refresh.html
which used a meta refresh to the destination/destination.html
which used JavaScript to write the referrer into the page.I ran the test in several browsers by opening
page.html
and clicking on the link, then observing what the referrer was on the destination. Here are the results:http://example.com/refresh.html
http://example.com/refresh.html
http://example.com/refresh.html
None of the browsers showed
http://example.com/page.html
as the referrer the way that they would with a 301 or 302 redirect. So meta refresh can be used to some extent to obscure the referrer:事实上,只需使用延迟提交的表单,就可以欺骗 Firefox 和 Internet Explorer,通过保留的引荐来源网址获得相同的重定向结果。
示例:
Indeed, it's possible to trick Firefox and Internet Explorer, getting the same redirection result, with preserved referrer, by simply using a form with delayed submit.
Example: