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 | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'ancestorOrigins ' in that specification. |
Living Standard |
Browser compatibility
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.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
ancestorOrigins | Chrome Full support 20 | Edge Full support 79 | Firefox No support No | IE No support No | Opera Full support 15 | Safari Full support 6 | WebView Android Full support 4.4 | Chrome Android Full support 25 | Firefox Android No support No | Opera Android Full support 14 | Safari iOS Full support 6 | Samsung Internet Android Full support 1.5 |
Legend
- Full support
- Full support
- No support
- No support