Window: thuộc tính origin
The origin read-only property of the Window interface returns the origin of the global scope, serialized as a string.
Giá trị
A string.
Ví dụ
Executed from inside window scope, the following snippet will log the document's global scope's origin to the console.
js
console.log(window.origin); // On this page returns 'https://mdn.go-mizu.dev'
If the origin is not a scheme/host/port tuple (say you are trying to run it locally, i.e., via file:// URL), origin will return the string "null".
Đặc tả kỹ thuật
| Specification |
|---|
| HTML> # dom-origin-dev> |
Tính tương thích trên trình duyệt
Xem thêm
WorkerGlobalScope.origin- origin glossary term