origin
只读特性在
URL
interface returns a
USVString
containing the Unicode serialization of the origin of the represented URL.
The exact structure varies depending on the type of URL:
http
or
https
URLs, the scheme followed by
'://'
, followed by the domain, followed by
':'
, followed by the port (the default port,
80
and
443
respectively, if explicitly specified).
文件:
URLs, the value is browser dependant.
blob:
URLs, the origin of the URL following
blob:
will be used, e.g
"blob:https://mozilla.org"
will be returned as
"https://mozilla.org".
const originString = url.origin
A
USVString
.
const url = new URL("blob:https://mozilla.org:443/")
console.log(url.origin); // Logs 'https://mozilla.org'
| 规范 | 状态 | 注释 |
|---|---|---|
|
URL
The definition of 'URL.origin' in that specification. |
实时标准 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
origin
|
Chrome 32 | Edge 12 |
Firefox
26
|
IE No | Opera Yes | Safari 10 | WebView Android ≤37 | Chrome Android 32 |
Firefox Android
26
|
Opera Android Yes | Safari iOS Yes | Samsung Internet Android 6.0 |
完整支持
不支持
见实现注意事项。
URL
interface