Url片段和Referer标头

Url片段和Referer标头

本文介绍了Url片段和Referer标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设您的网址含有一个片段(后面的部分),然后按一下连结前往其他网页。大多数浏览器会在 Referer 标头中将原始网页的网址传送到伺服器。我想知道的是URL片段是否将包括在这是否。

Imagine you are on a page whose URL has a fragment (the part after the #), and click a link to go to another page. Most browsers will send the URL of the original page to the server in the Referer header. What I want to know is whether or not the URL fragment will be included in this or not.

我在野外看到了各种行为,所以这可能是浏览器特定的。有谁知道哪些浏览器做什么?

I have seen various behaviors in the wild so this might be browser-specific. Does anyone know which browsers do what? And what does the HTTP spec say on this?

推荐答案

规范说Referer不能包含片段标识符)。请参见。

The spec says that Referer can't include a fragment identifier (per ABNF). See RFC 2616, Section 14.36.

这篇关于Url片段和Referer标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 16:51