If you redirect a user to a new web page using the javascript location.href = <url>
, what REFERER header does the destination web server see?
相关问题
- Angular RxJS mergeMap types
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
it sees the page it came from, just like clicking on a link.
To test this from any page, redirect to a phpinfo() page or any other page that echos headers, for example:
(page pulled from random google search)
Most browsers will pass a HTTP_REFFERER with location.href, but IE in some cases does not.
If the refferers are really important to you, then you could do this:
With some exceptions, the header sent is of the page with the redirect on it, not the referrer of the page that did the redirect. This is in contrast to server-side redirects, which preserve the original referrer.
So, if a visitor goes from
A.html
toB.html
, andB.html
triggers alocation.href
redirect toC.html
, the web server will seeB.html
as the referrer. (If you did the redirect fromB.html
toC.html
on the serverside,A.html
would be the referrer forC.html
.)Older versions of Internet Explorer will send a blank header, as will (as always) redirects from HTTPS to HTTP.