Location: ancestorOrigins
Location
接口的 ancestorOrigins
只读属性是一个静态的DOMStringList
,倒序排列了此Location
对象所属文档先前所有浏览上下文的来源。
你可以在脚本中使用location.ancestorOrigins
来检测你的网页是否被你不希望的对象嵌入了。你也可以使用它让网页在被特定站点嵌入时做出不同的表现。
语法
js
const ancestors = location.ancestorOrigins;
规范
Specification |
---|
HTML # dom-location-ancestororigins-dev |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ancestorOrigins |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- See implementation notes.
- User must explicitly enable this feature.
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.