"Referer" or "Referrer"? Is this a misspelling or is it correct?

9

Honestly, I have a tremendous doubt right now. I just gave this answer here in stackoverflow:

link

In this answer, I teach that, to refer to the previous page, we should use the variable $_SERVER['HTTP_REFERER'] . I even did tests before, because as usual I always wonder if it is with one or two letters R ;

My confusion increased when I came across this on Javascript :

 document.referrer; // What? Com dois R?

And I know that both PHP and Javascript both refer to the previous page.

So, confused, I would like to know: The right one is R er or RR er?

    
asked by anonymous 14.04.2016 / 22:04

1 answer

17

It is a misspelling in the HTTP protocol specification that was maintained per use.

  The referer, or HTTP referer (it is erroneously written as a referer in the official HTTP specifications and standardized so since) is an HTTP header field that identifies the web page address.

The error was committed by Phillip Hallam-Baker and Roy Fielding in 1992 . When they noticed the misspelling there were already many implementations that used the code, and it could not be changed.

Spellchecks are usually made in other layers, such as PHP. In Javascript, the interpreted value is correctly loaded into document.referrer .

Source: Wikipedia .

    
14.04.2016 / 22:06