--- title: URL slug: Web/API/URL tags: - API - Experimental - NeedsTranslation - TopicStub - URL API translation_of: Web/API/URL ---
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 {{domxref("Window.URL")}} properties (prefixed with Webkit-based browser as Window.webkitURL).
Implements properties defined in {{domxref("URLUtils")}}.
':'.':', and the port of the URL.'/' followed by the path of the URL.'?' followed by the parameters of the URL.'#' followed by the fragment identifier of the URL.URL object composed from the given parameters.The URL interface implements methods defined in {{domxref("URLUtils")}}.
blob: as its scheme, followed by an opaque string uniquely identifying the object in the browser.| Specification | Status | Comment |
|---|---|---|
| {{SpecName('File API', '#creating-revoking', 'URL')}} | {{Spec2('File API')}} | Added the static methods URL.createObjectURL() and URL.revokeObjectURL(). |
| {{SpecName('URL', '#api', 'Node')}} | {{Spec2('URL')}} | Initial definition (implements URLUtils). |
{{CompatibilityTable}}
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | 8.0 as webkitURL35 |
{{CompatGeckoDesktop("2.0")}} (non-standard name) [1] {{CompatGeckoDesktop("19.0")}} |
10.0 | 15.0 as webkitURL |
6.0 as webkitURL7.0 |
URLUtils properties |
32 | {{CompatVersionUnknown}} | {{CompatUnknown}} | 19 | {{CompatVersionUnknown}} |
username, password, and origin |
32 | {{CompatGeckoDesktop("26.0")}} | {{CompatUnknown}} | 19 | {{CompatVersionUnknown}} |
protocol, host, hostname, port, href, pathname, search, hash |
32 | {{CompatGeckoDesktop("22.0")}} | {{CompatUnknown}} | 19 | {{CompatVersionUnknown}} |
searchParams |
{{CompatNo}} | {{CompatGeckoDesktop("29.0")}} | {{CompatUnknown}} | 19 | {{CompatVersionUnknown}} |
| Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|
| Basic support | {{CompatVersionUnknown}}as webkitURL |
{{CompatGeckoMobile("14.0")}}(non-standard name) [1] {{CompatGeckoMobile("19.0")}} |
{{CompatVersionUnknown}} | 15.0 as webkitURL |
6.0 as
|
URLUtils |
{{CompatUnknown}} | {{CompatNo}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatVersionUnknown}} |
username, password, href, and origin |
{{CompatUnknown}} | {{CompatGeckoDesktop("26.0")}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatVersionUnknown}} |
[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 {{domxref("window.URL")}}, in practice, this didn't make any difference.
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.