← Back to release summary

self.origin

Category
Miscellaneous
Type
New or changed feature
Status
Enabled by default (Chrome 59)
Intent stage
None

Summary

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.

Standards & signals

Docs: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/origin

View on chromestatus.com