这是 实验性技术
检查 浏览器兼容性表格 要小心谨慎在生产中使用这之前。

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 特性。

浏览器兼容性

The compatibility table on 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. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
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

图例

完整支持

完整支持

不支持

不支持

另请参阅

元数据

  • 最后修改: