self.origin returns the Unicode serialization of the origin of the settings object of the global represented by "self" (a Window or WorkerGlobalScope). This gives scripts a consistent way of getting their origin in both situations. Note that unlike location.origin this represents the actual origin of the global, not the origin of the URL it's loaded from. The difference can be substantial in the case of sandboxing, for example.
Status in Chromium
Enabled by default (tracking bug) in:
- Chrome for desktop release 59
- Chrome for Android release 59
- Android WebView release 59
Consensus & Standardization
Last updated on 2020-11-09