W3cubDocs

/Web APIs

Location: ancestorOrigins property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

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.

Value

A DOMStringList.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Opera Safari Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet WebView Android WebView on iOS
ancestorOrigins 20 79 No 15 6 25 No 14 6 1.5 4.4 6

© 2005–2025 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