"Referer" or "Referrer"? Is that a spelling error or is that correct?

Asked

Viewed 413 times

11

Honestly, I’m in tremendous doubt right now. I just gave that answer here at stackoverflow:

/a/123445/4995

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 in the Javascript:

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

And I know that the two things, both PHP and Javascript, serve to refer to the previous page.

So, confused, I’d like to know: The right is rightRer or refRRer (with one or two R)?

  • Before judging as out of scope, it is important to at least know the difference between one and the other (if it is not some kind of mistake, of course).;

  • 1

    I find it a very valid doubt, I myself had never noticed the spelling error.

1 answer

19


It is a spelling error in the HTTP protocol specification that has been maintained by use.

The referer, or HTTP referer (is misspelled as a referer in the official HTTP specifications and has been standardized since) is an HTTP header field that identifies the web page address.

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

Spelling corrections are usually done in other layers, as in the case of PHP. In Javascript the interpreted value is correctly loaded in Document.referrer.

Source: Wikipedia.

  • To finish shit, PHP makes me one of those. Really, I didn’t know this information.

  • 4

    @Wallacemaxters is not PHP that does this, the variables HTTP_ in PHP are automatically generated and retrieved from the sent headers, php takes all headers and adds prefix HTTP_, who sent so Referer: was the browser :)

  • Ah, I get it. Phew, one less PHP shit then.

  • 7

    @Wallacemaxters This time around it’s not PHP’s fault. ;)

  • 2

    @Onosendai I do not know if it is important to quote in the question, but this difference then between the two languages, is because the HTTP_REFERER comes from browser headers, not a language-specific functionality.,

Browser other questions tagged

You are not signed in. Login or sign up in order to post.