URLUtilsReadOnly

Obsolete
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

obsolete URLUtilsReadOnly interface previously defined utility methods for working with URLs. These were then inherited by other interfaces, such as WorkerLocation . URLUtilsReadOnly has been removed from the specification, and the properties it defined are now directly part of the affected interfaces.

特性

This interface doesn't inherit any properties.

URLUtilsReadOnly.href 只读
DOMString containing the whole URL.
URLUtilsReadOnly.protocol 只读
DOMString 包含 URL 的协议方案,包括最终的 ':' .
URLUtilsReadOnly.host 只读
DOMString 包含主机,即 hostname ':' ,和 port of the URL.
URLUtilsReadOnly.hostname 只读
DOMString 包含 URL 的域。
URLUtilsReadOnly.origin 只读
返回 DOMString containing the canonical form of the origin of the specific location.
URLUtilsReadOnly.port 只读
DOMString 包含 URL 的端口号。
URLUtilsReadOnly.pathname 只读
DOMString 包含初始 '/' followed by the path of the URL.
URLUtilsReadOnly.search 只读
DOMString 包含 '?' followed by the parameters of the URL.
URLUtilsReadOnly.hash 只读
DOMString 包含 '#' followed by the fragment identifier of the URL.

方法

This interface doesn't inherit any methods.

URLUtilsReadOnly.toString()
返回 DOMString containing the whole URL. It is a synonym for URLUtilsReadOnly.href .

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
URLUtilsReadOnly Chrome No Edge No Firefox 57
57
不支持 3.5 — 57
Firefox has a bug whereby single quotes contained in URLs are escaped when accessed via URL APIs (see bug 1386683 ).
IE No Opera No Safari No WebView Android No Chrome Android No Firefox Android 57
57
不支持 4 — 57
Firefox has a bug whereby single quotes contained in URLs are escaped when accessed via URL APIs (see bug 1386683 ).
Opera Android No Safari iOS No Samsung Internet Android No
hash
Chrome No Edge No Firefox 38
38
不支持 3.5 — 38
Before Firefox 38, Firefox returned the hash percent encoded. This has been fixed to match the spec.
IE No Opera No Safari No WebView Android No Chrome Android No Firefox Android 38
38
不支持 4 — 38
Before Firefox 38, Firefox returned the hash percent encoded. This has been fixed to match the spec.
Opera Android No Safari iOS No Samsung Internet Android No
host
Chrome No Edge No Firefox 3.5 IE No Opera No Safari No WebView Android No Chrome Android No Firefox Android 4 Opera Android No Safari iOS No Samsung Internet Android No
hostname
Chrome No Edge No Firefox 3.5 IE No Opera No Safari No WebView Android No Chrome Android No Firefox Android 4 Opera Android No Safari iOS No Samsung Internet Android No
href
Chrome No Edge No Firefox 3.5 IE No Opera No Safari No WebView Android No Chrome Android No Firefox Android 4 Opera Android No Safari iOS No Samsung Internet Android No
origin
Chrome No Edge No Firefox 29 IE No Opera No Safari No WebView Android No Chrome Android No Firefox Android 29 Opera Android No Safari iOS No Samsung Internet Android No
pathname
Chrome No Edge No Firefox 3.5 IE No Opera No Safari No WebView Android No Chrome Android No Firefox Android 4 Opera Android No Safari iOS No Samsung Internet Android No
port
Chrome No Edge No Firefox 3.5 IE No Opera No Safari No WebView Android No Chrome Android No Firefox Android 4 Opera Android No Safari iOS No Samsung Internet Android No
protocol
Chrome No Edge No Firefox 3.5 IE No Opera No Safari No WebView Android No Chrome Android No Firefox Android 4 Opera Android No Safari iOS No Samsung Internet Android No
search
Chrome No Edge No Firefox 3.5 IE No Opera No Safari No WebView Android No Chrome Android No Firefox Android 4 Opera Android No Safari iOS No Samsung Internet Android No
toString
Chrome No Edge No Firefox 3.5 IE No Opera No Safari No WebView Android No Chrome Android No Firefox Android 4 Opera Android No Safari iOS No Samsung Internet Android No

图例

完整支持
完整支持
不支持
不支持
实验。期望将来行为有所改变。
实验。期望将来行为有所改变。
见实现注意事项。

另请参阅