Location: ancestorOrigins
The ancestorOrigins
read-only property of the Location
interface is a static DOMStringList
containing, in reverse order, the origins of all ancestor browsing contexts of the document associated with the given Location
object.
You can use location.ancestorOrigins
in the script for a document to determine, for example, whenever the document is being framed by a site which you don’t expect it to be framed by. You can also use it to vary the behavior of the document based on what site or list of sites is framing it.
Syntax
const ancestors = location.ancestorOrigins;
Specifications
Specification |
---|
HTML Standard (HTML) # dom-location-ancestororigins-dev |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
ancestorOrigins |
20 |
79 |
No |
No |
15 |
6 |
4.4 |
25 |
No |
14 |
6 |
1.5 |
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Location/ancestorOrigins