Document.referrer
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
Document.referrer 返回的是一个 URI,当前页面就是从这个 URI 所代表的页面跳转或打开的。
值
如果用户直接打开了这个页面(不是通过页面跳转,而是通过地址栏或者书签等打开的),则该属性为空字符串。由于该属性只是返回一个字符串,所以不能够通过该属性引用页面的 DOM。
在 <iframe> 中,Document.referrer 会初始化为父窗口 Window.location 的 href。
规范
| Specification |
|---|
| HTML> # dom-document-referrer-dev> |
浏览器兼容性
Loading…