URL

by 1 contributor:

This translation is incomplete. Please help translate this article from English.

これは実験段階の機能です。
この機能は複数のブラウザで開発中の状態にあります。各ブラウザで用いるために、適切なベンダー接頭辞が必要な場合があります。互換性テーブルをチェックしてください。また、実験段階の機能の構文と挙動は、仕様変更に伴い各ブラウザの将来のバージョンで変更になる可能性があることに注意してください。

The URL interface represent an object providing static methods used for creating object URLs.

When using a user agent where no constructor has been implemented yet, it is possible to access such an object using the non-standard Window.URL properties (prefixed with Webkit- and Blink-based browser as Window.webkitURL).

Properties

Implements properties defined in URLUtils.

URLUtils.href
Is a DOMString containing the whole URL.
URLUtils.protocol
Is a DOMString containing the protocol scheme of the URL, including the final ':'.
URLUtils.host
Is a DOMString containing the host, that is the hostname, a ':', and the port of the URL.
URLUtils.hostname
Is a DOMString containing the domain of the URL.
URLUtils.port
Is a DOMString containing the port number of the URL.
URLUtils.pathname
Is a DOMString containing an initial '/' followed by the path of the URL.
URLUtils.search
Is a DOMString containing a '?' followed by the parameters of the URL.
URLUtils.hash
Is a DOMString containing a '#' followed by the fragment identifier of the URL.
URLUtils.username
Is a DOMString containing the username specified before the domain name.
URLUtils.password
Is a DOMString containing the password specified before the domain name.
URLUtils.origin 読取専用
Returns a DOMString containing the origin of the URL, that is its scheme, its domain and its port.
URLUtils.searchParams
Returns a URLSearchParams object allowing to access the GET query arguments contained in the URL.

Constructor

URL()
Creates and return a URL object composed from the given parameters.

Methods

The URL interface implements methods defined in URLUtils.

URLUtils.toString()
Returns a DOMString containing the whole URL. It is a synonym for URLUtils.href, though it can't be used to modify the value.

Static methods

URL.createObjectURL()
Returns a DOMString containing a unique blob URL, that is a URL with blob: as its scheme, followed by an opaque string uniquely identifying the object in the browser.
URL.revokeObjectURL()
Revokes an object URL previously created using URL.createObjectURL().

Specifications

Specification Status Comment
File API
The definition of 'URL' in that specification.
草案 Added the static methods URL.createObjectURL() and URL.revokeObjectURL().
URL
The definition of 'Node' in that specification.
Living Standard Initial definition (implements URLUtils).

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 8.0 as webkitURL
35
4.0 (2.0) (non-standard name) [1]
19.0 (19.0)
10.0 15.0 as webkitURL
(有)
6.0 as webkitURL
7.0
URLUtils properties 32 (有) ? 19 (有)
username, password, and origin 32 26.0 (26.0) ? 19 (有)
protocol, host, hostname, port, href, pathname, search, hash 32 22.0 (22.0) ? 19 (有)
searchParams 32 29.0 (29.0) ? 19 (有)
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (有)as webkitURL 14.0 (14.0)(non-standard name) [1]
19.0 (19.0)
(有) 15.0 as webkitURL

6.0 as webkitURL

 

URLUtils ? 未サポート ? ? (有)
username, password, href, and origin ? 26.0 (26.0) ? ? (有)

[1] From Gecko 2 (Firefox 4) to Gecko 18 included, Gecko supported this interface with the non-standard nsIDOMMozURLProperty internal type. As the only to access such an object was through window.URL, in practice, this didn't make any difference.

Chrome Code - Scope Availability

To use from chrome code, JSM and Bootstrap scope, you have to import it like this:

Cu.importGlobalProperties(['URL']);

URL is available in Worker scopes.

See also

ドキュメントのタグと貢献者

タグ: 
Contributors to this page: fscholz
最終更新者: fscholz,