http-equiv="refresh" 是否有效?保留引用信息和元数据?

发布于 2024-09-04 02:34:43 字数 227 浏览 2 评论 0 原文

如果我设置这样的页面:

<html><head><meta http-equiv="refresh" content="0;url=http://internic.net/"></head><body></body></html>

执行重定向时浏览器会发送引荐来源网址信息和其他元数据吗?

If I set up a page like this:

<html><head><meta http-equiv="refresh" content="0;url=http://internic.net/"></head><body></body></html>

Will the browser send referrer info and other metadata when the redirection is performed?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

十级心震 2024-09-11 02:34:43

在此测试中,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.

梨涡少年 2024-09-11 02:34:43

我对此做了一些额外的测试。我涉及三个 URI(都在同一个域上):

  • /page.html 它有一个指向元刷新的链接
  • /refresh.html 它使用元刷新来目的地
  • /destination.html 使用 JavaScript 将引荐来源网址写入页面。

我在多个浏览器中运行了测试,打开 page.html 并单击链接,然后观察目的地上的引荐来源网址。结果如下:

  • Internet Explorer - 无引荐来源网址
  • Firefox - 无引荐来源网址
  • Chrome - 引荐来源网址:http://example.com/ fresh.html
  • Safari - 引荐来源:http://example.com/refresh.html
  • Opera - 引荐来源: 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:

  • Internet Explorer - No referrer
  • Firefox - No referrer
  • Chrome - Referrer: http://example.com/refresh.html
  • Safari - Referrer: http://example.com/refresh.html
  • Opera - Referrer: 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:

  • Hide the specific page that had the link
  • Remove the query string from the referrer
  • If a third party site hosted the refresh, hide the specific site that linked
  • Remove the external referrer on incoming traffic (useful in situations like this)
2024-09-11 02:34:43

事实上,只需使用延迟提交的表单,就可以欺骗 FirefoxInternet Explorer,通过保留的引荐来源网址获得相同的重定向结果。

示例:

<form action="URL" method="GET" name="redirected"></form>
<script>
   setTimeout(function() {
      document.forms.redirected.submit();
   }, 1000);
</script>

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:

<form action="URL" method="GET" name="redirected"></form>
<script>
   setTimeout(function() {
      document.forms.redirected.submit();
   }, 1000);
</script>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文