我們的志工尚未將此文章翻譯為 正體中文 (繁體) 版本。加入我們,幫忙翻譯!
The Referer
request header contains the address of the previous web page from which a link to the currently requested page was followed. The Referer
header allows servers to identify where people are visiting them from and may use that data for analytics, logging, or optimized caching, for example.
Note that referer is actually a misspelling of the word "referrer". See HTTP referer on Wikipedia for more details.
The Referer
header has the potential to reveal information about the browsing history of the user, which is a privacy concern.
A Referer
header is not sent by browsers if:
- the referring resource is a local "file" or "data" URI,
-
an unsecured HTTP request is used and the referring page was received with a secure protocol (HTTPS).
Header type | Request header |
---|---|
Forbidden header name | yes |
Syntax
Referer: <url>
Directives
- <url>
- An absolute or partial address of the previous web page from which a link to the currently requested page was followed. URL fragments (i.e. "#section") are not included.
Examples
Referer: https://developer.mozilla.org/en-US/docs/Web/JavaScript
Specifications
Specification | Title |
---|---|
RFC 7231, section 5.5.2: Referer | Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content |
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | Servo |
---|---|---|---|---|---|---|---|
Basic Support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
Feature | Android | Chrome for Android | Edge Mobile | Firefox for Android | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic Support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |