Url fragment and Referer header
Asked Answered
T

3

11

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?

Tenant answered 14/10, 2010 at 3:36 Comment(0)
D
10

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

Diary answered 14/10, 2010 at 6:51 Comment(2)
Does that bear out in practice though? I'm pretty sure I've seen at least some browsers include it.Tenant
That would be interesting; if you can reproduce it please follow up on the IETF HTTPbis WG's mailing list.Diary
R
2

I saw the same behavior in IE today. I am using IE 11.0.9600.17801 and upon inspection i found out that the 'Referer' header contains this fragment identifier.

Referer: //abc:8080/myapp/ver/index.htm#search-basics

Although I am quite certain that I have seen this behavior on and off with the same browser.

Radbun answered 8/3, 2016 at 16:52 Comment(0)
P
0

The spec says basicly that you can do whatever you want - it is an optional header, i just tested webkit ignores the fragment, as do firefox and IE.

Planula answered 14/10, 2010 at 4:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.