这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
HTMLAreaElement
.referrerPolicy
property reflect the HTML
referrerpolicy
属性在
<area>
element defining which referrer is sent when fetching the resource.
refStr = areaElt.referrerPolicy; areaElt.referrerPolicy = refStr;
"no-referrer"
meaning that the
Referer:
HTTP header will not be sent.
"origin"
meaning that the referrer will be the origin of the page, that is roughly the scheme, the host and the port.
"unsafe-url"
meaning that the referrer will include the origin and the path (but not the fragment, password, or username). This case is unsafe as it can leak path information that has been concealed to third-party by using TLS.
<img usemap="#mapAround" width="100" height="100" src="/img/logo@2x.png" /> <map id="myMap" name="mapAround" />>
var elt = document.createElement("area");
elt.href = "/img2.png";
elt.shape = "rect";
elt.referrerPolicy = "no-referrer";
elt.coords = "0,0,100,100";
var map = document.getElementById("myMap");
map.appendChild(elt);
// When clicked, the area's link will not send a referrer header.
| 规范 | 状态 | 注释 |
|---|---|---|
|
Referrer Policy
The definition of 'referrerpolicy attribute' in that specification. |
候选推荐 |
添加
referrerPolicy
特性。
|
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
referrerPolicy
|
Chrome 51 | Edge 79 | Firefox 50 | IE No | Opera 38 | Safari 11.1 | WebView Android 51 | Chrome Android 51 | Firefox Android 50 | Opera Android 41 | Safari iOS No | Samsung Internet Android 7.2 |
完整支持
不支持
HTMLImageElement.referrerPolicy
,
HTMLAnchorElement.referrerPolicy
,和
HTMLIFrameElement.referrerPolicy
.