diff --git a/files/en-us/_redirects.txt b/files/en-us/_redirects.txt index 99a2388ffea12fc..60fe40863556038 100644 --- a/files/en-us/_redirects.txt +++ b/files/en-us/_redirects.txt @@ -7063,7 +7063,7 @@ /en-US/docs/URI/www and non-www URLs /en-US/docs/Web/HTTP/Basics_of_HTTP/Choosing_between_www_and_non-www_URLs /en-US/docs/URI/www_vs_non-www_URLs /en-US/docs/Web/HTTP/Basics_of_HTTP/Choosing_between_www_and_non-www_URLs /en-US/docs/URL.createObjectURL /en-US/docs/Web/API/URL/createObjectURL -/en-US/docs/URLUtilsReadOnly.origin /en-US/docs/Web/API/URLUtilsReadOnly/origin +/en-US/docs/URLUtilsReadOnly.origin /en-US/docs/Web/API/WorkerLocation/origin /en-US/docs/USA /en-US/docs/Web/Progressive_web_apps /en-US/docs/USA-redirect-1 /en-US/docs/Web/Progressive_web_apps /en-US/docs/USE_EXTENSION_MANIFEST https://github.com/mdn/archived-content/tree/main/files/en-us/mozilla/developer_guide/build_instructions/configuring_build_options @@ -9023,18 +9023,29 @@ /en-US/docs/Web/API/URL.URL /en-US/docs/Web/API/URL/URL /en-US/docs/Web/API/URL.createObjectURL /en-US/docs/Web/API/URL/createObjectURL /en-US/docs/Web/API/URL.revokeObjectURL /en-US/docs/Web/API/URL/revokeObjectURL -/en-US/docs/Web/API/URLReadOnlyUtils.origin /en-US/docs/Web/API/URLUtilsReadOnly/origin +/en-US/docs/Web/API/URLReadOnlyUtils.origin /en-US/docs/Web/API/WorkerLocation/origin /en-US/docs/Web/API/URLUtils/createObjectURL /en-US/docs/Web/API/URL/createObjectURL -/en-US/docs/Web/API/URLUtilsReadOnly.hash /en-US/docs/Web/API/URLUtilsReadOnly/hash -/en-US/docs/Web/API/URLUtilsReadOnly.host /en-US/docs/Web/API/URLUtilsReadOnly/host -/en-US/docs/Web/API/URLUtilsReadOnly.hostname /en-US/docs/Web/API/URLUtilsReadOnly/hostname -/en-US/docs/Web/API/URLUtilsReadOnly.href /en-US/docs/Web/API/URLUtilsReadOnly/href -/en-US/docs/Web/API/URLUtilsReadOnly.origin /en-US/docs/Web/API/URLUtilsReadOnly/origin -/en-US/docs/Web/API/URLUtilsReadOnly.pathname /en-US/docs/Web/API/URLUtilsReadOnly/pathname -/en-US/docs/Web/API/URLUtilsReadOnly.port /en-US/docs/Web/API/URLUtilsReadOnly/port -/en-US/docs/Web/API/URLUtilsReadOnly.protocol /en-US/docs/Web/API/URLUtilsReadOnly/protocol -/en-US/docs/Web/API/URLUtilsReadOnly.search /en-US/docs/Web/API/URLUtilsReadOnly/search -/en-US/docs/Web/API/URLUtilsReadOnly.toString /en-US/docs/Web/API/URLUtilsReadOnly/toString +/en-US/docs/Web/API/URLUtilsReadOnly /en-US/docs/Web/API/WorkerLocation +/en-US/docs/Web/API/URLUtilsReadOnly.hash /en-US/docs/Web/API/WorkerLocation/hash +/en-US/docs/Web/API/URLUtilsReadOnly.host /en-US/docs/Web/API/WorkerLocation/host +/en-US/docs/Web/API/URLUtilsReadOnly.hostname /en-US/docs/Web/API/WorkerLocation/hostname +/en-US/docs/Web/API/URLUtilsReadOnly.href /en-US/docs/Web/API/WorkerLocation/href +/en-US/docs/Web/API/URLUtilsReadOnly.origin /en-US/docs/Web/API/WorkerLocation/origin +/en-US/docs/Web/API/URLUtilsReadOnly.pathname /en-US/docs/Web/API/WorkerLocation/pathname +/en-US/docs/Web/API/URLUtilsReadOnly.port /en-US/docs/Web/API/WorkerLocation/port +/en-US/docs/Web/API/URLUtilsReadOnly.protocol /en-US/docs/Web/API/WorkerLocation/protocol +/en-US/docs/Web/API/URLUtilsReadOnly.search /en-US/docs/Web/API/WorkerLocation/search +/en-US/docs/Web/API/URLUtilsReadOnly.toString /en-US/docs/Web/API/WorkerLocation/toString +/en-US/docs/Web/API/URLUtilsReadOnly/hash /en-US/docs/Web/API/WorkerLocation/hash +/en-US/docs/Web/API/URLUtilsReadOnly/host /en-US/docs/Web/API/WorkerLocation/host +/en-US/docs/Web/API/URLUtilsReadOnly/hostname /en-US/docs/Web/API/WorkerLocation/hostname +/en-US/docs/Web/API/URLUtilsReadOnly/href /en-US/docs/Web/API/WorkerLocation/href +/en-US/docs/Web/API/URLUtilsReadOnly/origin /en-US/docs/Web/API/WorkerLocation/origin +/en-US/docs/Web/API/URLUtilsReadOnly/pathname /en-US/docs/Web/API/WorkerLocation/pathname +/en-US/docs/Web/API/URLUtilsReadOnly/port /en-US/docs/Web/API/WorkerLocation/port +/en-US/docs/Web/API/URLUtilsReadOnly/protocol /en-US/docs/Web/API/WorkerLocation/protocol +/en-US/docs/Web/API/URLUtilsReadOnly/search /en-US/docs/Web/API/WorkerLocation/search +/en-US/docs/Web/API/URLUtilsReadOnly/toString /en-US/docs/Web/API/WorkerLocation/toString /en-US/docs/Web/API/USBDevice/USBDevice.deviceClass /en-US/docs/Web/API/USBDevice/deviceClass /en-US/docs/Web/API/Uint16Array /en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array /en-US/docs/Web/API/Uint32Array /en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array @@ -9328,17 +9339,7 @@ /en-US/docs/Web/API/WorkerGlobalScope/indexedDB /en-US/docs/Web/API/WindowOrWorkerGlobalScope/indexedDB /en-US/docs/Web/API/WorkerGlobalScope/setInterval /en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval /en-US/docs/Web/API/WorkerGlobalScope/setTimeout /en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout -/en-US/docs/Web/API/WorkerLocation.hash /en-US/docs/Web/API/URLUtilsReadOnly/hash -/en-US/docs/Web/API/WorkerLocation/hash /en-US/docs/Web/API/URLUtilsReadOnly/hash -/en-US/docs/Web/API/WorkerLocation/host /en-US/docs/Web/API/URLUtilsReadOnly/host -/en-US/docs/Web/API/WorkerLocation/hostname /en-US/docs/Web/API/URLUtilsReadOnly/hostname -/en-US/docs/Web/API/WorkerLocation/href /en-US/docs/Web/API/URLUtilsReadOnly/href -/en-US/docs/Web/API/WorkerLocation/origin /en-US/docs/Web/API/URLUtilsReadOnly/origin -/en-US/docs/Web/API/WorkerLocation/pathname /en-US/docs/Web/API/URLUtilsReadOnly/pathname -/en-US/docs/Web/API/WorkerLocation/port /en-US/docs/Web/API/URLUtilsReadOnly/port -/en-US/docs/Web/API/WorkerLocation/protocol /en-US/docs/Web/API/URLUtilsReadOnly/protocol -/en-US/docs/Web/API/WorkerLocation/search /en-US/docs/Web/API/URLUtilsReadOnly/search -/en-US/docs/Web/API/WorkerLocation/toString /en-US/docs/Web/API/URLUtilsReadOnly/toString +/en-US/docs/Web/API/WorkerLocation.hash /en-US/docs/Web/API/WorkerLocation/hash /en-US/docs/Web/API/WorkerNavigator/appCodeName /en-US/docs/Web/API/NavigatorID/appCodeName /en-US/docs/Web/API/WorkerNavigator/appName /en-US/docs/Web/API/NavigatorID/appName /en-US/docs/Web/API/WorkerNavigator/appVersion /en-US/docs/Web/API/NavigatorID/appVersion diff --git a/files/en-us/_wikihistory.json b/files/en-us/_wikihistory.json index 87d77001a15bb54..aee0012c07312dd 100644 --- a/files/en-us/_wikihistory.json +++ b/files/en-us/_wikihistory.json @@ -84525,101 +84525,6 @@ "teoli" ] }, - "Web/API/URLUtilsReadOnly": { - "modified": "2020-11-13T08:33:28.460Z", - "contributors": [ - "Rumyra", - "alattalatta", - "sideshowbarker", - "Sheppy", - "connorshea", - "chrisdavidmills", - "teoli" - ] - }, - "Web/API/URLUtilsReadOnly/hash": { - "modified": "2020-10-15T21:24:48.282Z", - "contributors": [ - "connorshea", - "Sebastianz", - "teoli", - "kscarfone" - ] - }, - "Web/API/URLUtilsReadOnly/host": { - "modified": "2020-10-15T21:24:47.049Z", - "contributors": [ - "connorshea", - "teoli", - "kscarfone" - ] - }, - "Web/API/URLUtilsReadOnly/hostname": { - "modified": "2020-10-15T21:24:48.709Z", - "contributors": [ - "connorshea", - "teoli", - "namolmes" - ] - }, - "Web/API/URLUtilsReadOnly/href": { - "modified": "2020-10-15T21:24:47.886Z", - "contributors": [ - "chrisdavidmills", - "connorshea", - "teoli", - "namolmes" - ] - }, - "Web/API/URLUtilsReadOnly/origin": { - "modified": "2020-10-15T21:29:33.056Z", - "contributors": [ - "connorshea", - "teoli" - ] - }, - "Web/API/URLUtilsReadOnly/pathname": { - "modified": "2020-11-13T08:37:16.486Z", - "contributors": [ - "Rumyra", - "connorshea", - "teoli", - "namolmes" - ] - }, - "Web/API/URLUtilsReadOnly/port": { - "modified": "2020-10-15T21:24:48.116Z", - "contributors": [ - "connorshea", - "teoli", - "namolmes" - ] - }, - "Web/API/URLUtilsReadOnly/protocol": { - "modified": "2020-10-15T21:24:48.030Z", - "contributors": [ - "connorshea", - "teoli", - "namolmes" - ] - }, - "Web/API/URLUtilsReadOnly/search": { - "modified": "2020-10-15T21:24:48.707Z", - "contributors": [ - "connorshea", - "teoli", - "namolmes" - ] - }, - "Web/API/URLUtilsReadOnly/toString": { - "modified": "2020-10-15T21:24:47.891Z", - "contributors": [ - "sideshowbarker", - "connorshea", - "teoli", - "namolmes" - ] - }, "Web/API/URL_API": { "modified": "2020-12-14T00:08:04.182Z", "contributors": [ @@ -94742,6 +94647,89 @@ "teoli" ] }, + "Web/API/WorkerLocation/hash": { + "modified": "2020-10-15T21:24:48.282Z", + "contributors": [ + "connorshea", + "Sebastianz", + "teoli", + "kscarfone" + ] + }, + "Web/API/WorkerLocation/host": { + "modified": "2020-10-15T21:24:47.049Z", + "contributors": [ + "connorshea", + "teoli", + "kscarfone" + ] + }, + "Web/API/WorkerLocation/hostname": { + "modified": "2020-10-15T21:24:48.709Z", + "contributors": [ + "connorshea", + "teoli", + "namolmes" + ] + }, + "Web/API/WorkerLocation/href": { + "modified": "2020-10-15T21:24:47.886Z", + "contributors": [ + "chrisdavidmills", + "connorshea", + "teoli", + "namolmes" + ] + }, + "Web/API/WorkerLocation/origin": { + "modified": "2020-10-15T21:29:33.056Z", + "contributors": [ + "connorshea", + "teoli" + ] + }, + "Web/API/WorkerLocation/pathname": { + "modified": "2020-11-13T08:37:16.486Z", + "contributors": [ + "Rumyra", + "connorshea", + "teoli", + "namolmes" + ] + }, + "Web/API/WorkerLocation/port": { + "modified": "2020-10-15T21:24:48.116Z", + "contributors": [ + "connorshea", + "teoli", + "namolmes" + ] + }, + "Web/API/WorkerLocation/protocol": { + "modified": "2020-10-15T21:24:48.030Z", + "contributors": [ + "connorshea", + "teoli", + "namolmes" + ] + }, + "Web/API/WorkerLocation/search": { + "modified": "2020-10-15T21:24:48.707Z", + "contributors": [ + "connorshea", + "teoli", + "namolmes" + ] + }, + "Web/API/WorkerLocation/toString": { + "modified": "2020-10-15T21:24:47.891Z", + "contributors": [ + "sideshowbarker", + "connorshea", + "teoli", + "namolmes" + ] + }, "Web/API/WorkerNavigator": { "modified": "2020-10-15T21:24:57.936Z", "contributors": [ diff --git a/files/en-us/web/api/url_api/index.html b/files/en-us/web/api/url_api/index.html index f0d108f5ad5a13e..e420a54cdf796e4 100644 --- a/files/en-us/web/api/url_api/index.html +++ b/files/en-us/web/api/url_api/index.html @@ -74,8 +74,6 @@
Older versions of the specification included an interface called {{domxref("URLUtilsReadOnly")}}, which has since been merged into the {{domxref("WorkerLocation")}} interface.
-If you want to process the parameters included in a URL, you could do it manually, but it's much easier to create a URL
object to do it for you. The fillTableWithParameters()
function below takes as input a {{domxref("HTMLTableElement")}} object representing a {{HTMLElement("table")}}. Rows are added to the table, one for each key found in the parameters, with the first column containing the key's name, and the second column having the value.
{{ApiRef("URL API")}}{{SeeCompatTable}}
- -The URLUtilsReadOnly
.hash
- read-only property returns a {{domxref("DOMString")}} containing a '#'
- followed by the fragment identifier of the URL. The hash is not percent encoded.
string = object.hash;- -
// In a Web worker, on the page https://developer.mozilla.org/en-US/docs/URLUtilsReadOnly.hash#example -var result = window.self.hash; // Returns:'#hash'- -
Specification | -Status | -Comment | -
---|---|---|
{{SpecName('URL', '#dom-url-hash', 'URLUtilsReadOnly.hash')}} | -{{Spec2('URL')}} | -Initial definition. | -
{{Compat("api.URLUtilsReadOnly.hash")}}
- -{{ApiRef("URL API")}}{{SeeCompatTable}}
- -The URLUtilsReadOnly
.host
- read-only property returns a {{domxref("DOMString")}} containing the host, that is the
- hostname, a ':'
, and the port of the URL.
string = object.host;- -
// In a Web worker, on the page https://developer.mozilla.org/en-US/URLUtilsReadOnly.host -var result = window.self.host; // Returns:'developer.mozilla.org:80' -- -
Specification | -Status | -Comment | -
---|---|---|
{{SpecName('URL', '#dom-url-host', 'URLUtilsReadOnly.host')}} | -{{Spec2('URL')}} | -Initial definition. | -
{{Compat("api.URLUtilsReadOnly.host")}}
- -{{ApiRef("URL API")}}{{SeeCompatTable}}
- -The
- URLUtilsReadOnly
.hostname
- read-only property returns a {{domxref("DOMString")}} containing the domain of the
- URL.
string = object.hostname;- -
// In a Web worker, on the page https://developer.mozilla.org/en-US/URLUtilsReadOnly.hostname -var result = window.self.hostname; // Returns:'developer.mozilla.org' -- -
Specification | -Status | -Comment | -
---|---|---|
{{SpecName('URL', '#dom-url-hostname', 'URLUtilsReadOnly.hostname')}} | -{{Spec2('URL')}} | -Initial definition. | -
{{Compat("api.URLUtilsReadOnly.hostname")}}
- -{{ApiRef("URL API")}}{{SeeCompatTable}}
- -The URLUtilsReadOnly
.href
- read-only property is a stringifier that returns a {{domxref("DOMString")}} containing
- the whole URL.
string = object.href;- -
// In a Web worker, on the page https://developer.mozilla.org/en-US/URLUtilsReadOnly.href -var result = window.self.href; // Returns:'https://developer.mozilla.org/en-US/URLUtilsReadOnly.href' -- -
Specification | -Status | -Comment | -
---|---|---|
{{SpecName('URL', '#dom-url-href', 'URLUtilsReadOnly.href')}} | -{{Spec2('URL')}} | -Initial definition. | -
{{Compat("api.URLUtilsReadOnly.href")}}
- -{{ApiRef("URL API")}}{{deprecated_header}}
- -The obsolete URLUtilsReadOnly
interface previously defined utility methods for working with URLs. These were then inherited by other interfaces, such as {{domxref("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.
- -':'
.':'
, and the port of the URL.'/'
followed by the path of the URL, not including the query string or fragment.'?'
followed by the parameters of the URL.'#'
followed by the fragment identifier of the URL.This interface doesn't inherit any methods.
- -{{Compat("api.URLUtilsReadOnly")}}
- -{{ApiRef("URL API")}}{{SeeCompatTable}}
- -The URLUtilsReadOnly
.origin
- read-only property is a {{domxref("DOMString")}} containing the Unicode serialization
- of the origin of the represented URL, that is, for http and https, the scheme followed
- by '://'
, followed by the domain, followed by ':'
, followed
- by the port (the default port, 80
and 443
respectively, if
- explicitly specified). For URL using file:
scheme, the value is browser
- dependant.
This version of origin
is implemented by {{domxref("WorkerLocation")}} for
- use on workers.
string = object.origin; -- -
// On this page, returns the origin -var result = self.location.origin; // Returns:'https://developer.mozilla.org:443' -- -
Specification | -Status | -Comment | -
---|---|---|
{{SpecName('URL', '#dom-url-origin', 'URLUtilsReadOnly.origin')}} | -{{Spec2('URL')}} | -Initial definition. | -
{{Compat("api.URLUtilsReadOnly.origin")}}
- -{{ApiRef("URL API")}}{{SeeCompatTable}}
- -The
- URLUtilsReadOnly
.pathname
- read-only property returns a {{domxref("USVString")}} containing an initial
- '/'
followed by the path of the URL, not including the query string or
- fragment.
string = object.pathname;- -
// In a Web worker, on the page https://developer.mozilla.org/en-US/URLUtilsReadOnly.pathname -var result = window.self.pathname; // Returns:'/en-US/URLUtilsReadOnly.pathname' -- -
Specification | -Status | -Comment | -
---|---|---|
{{SpecName('URL', '#dom-url-pathname', 'URLUtilsReadOnly.pathname')}} | -{{Spec2('URL')}} | -Initial definition. | -
{{Compat("api.URLUtilsReadOnly.pathname")}}
- -{{ApiRef("URL API")}}{{SeeCompatTable}}
- -The URLUtilsReadOnly
.port
- read-only property returns a {{domxref("DOMString")}} containing the port number of
- the URL.
string = object.port;- -
// In a Web worker, on the page https://developer.mozilla.org/en-US/URLUtilsReadOnly.port -var result = window.self.port; // Returns:'80' -- -
Specification | -Status | -Comment | -
---|---|---|
{{SpecName('URL', '#dom-url-port', 'URLUtilsReadOnly.port')}} | -{{Spec2('URL')}} | -Initial definition. | -
{{Compat("api.URLUtilsReadOnly.port")}}
- -{{ApiRef("URL API")}}{{SeeCompatTable}}
- -The
- URLUtilsReadOnly
.protocol
- read-only property returns a {{domxref("DOMString")}} containing the protocol scheme
- of the URL, including the final ':'
.
string = object.protocol;- -
// In a Web worker, on the page https://developer.mozilla.org/en-US/URLUtilsReadOnly.href -var result = window.self.protocol; // Returns:'https:' -- -
Specification | -Status | -Comment | -
---|---|---|
{{SpecName('URL', '#dom-url-protocol', 'URLUtilsReadOnly.protocol')}} | -{{Spec2('URL')}} | -Initial definition. | -
{{Compat("api.URLUtilsReadOnly.protocol")}}
- -{{ApiRef("URL API")}}{{SeeCompatTable}}
- -The URLUtilsReadOnly
.search
- read-only property returns a {{domxref("DOMString")}} containing a '?'
- followed by the parameters of the URL.
string = object.search;- -
// In a Web worker, on the page https://developer.mozilla.org/en-US/docs/URLUtilsReadOnly.href?t=67 -var result = window.self.search; // Returns:'?t=67' -- -
Specification | -Status | -Comment | -
---|---|---|
{{SpecName('URL', '#dom-url-search', 'URLUtilsReadOnly.search')}} | -{{Spec2('URL')}} | -Initial definition. | -
{{Compat("api.URLUtilsReadOnly.search")}}
- -{{ApiRef("URL API")}}{{SeeCompatTable}}
- -The
- URLUtilsReadOnly
.toString()
- stringifier method returns a {{domxref("DOMString")}} containing the whole URL. It is a
- synonym for {{domxref("URLUtilsReadOnly.href")}}.
string = object.toString();- -
// In a Web worker, on the page https://developer.mozilla.org/en-US/URLUtilsReadOnly.href -var result = window.self.toString(); // Returns:'https://developer.mozilla.org/en-US/URLUtilsReadOnly.href' -- -
{{Compat("api.URLUtilsReadOnly.toString")}}
- -{{ApiRef("WorkerLocation")}}
+ +The hash
property of a {{domxref("WorkerLocation")}} object returns the {{domxref("URL.hash", "hash")}} part of the worker’s location.
string = object.hash;+ +
// In a Web worker, on the page https://developer.mozilla.org/en-US/docs/WorkerLocation.hash#example +var result = window.self.hash; // Returns:'#hash'+ +
Specification | +Status | +Comment | +
---|---|---|
{{SpecName('HTML WHATWG', 'workers.html#dom-workerlocation-hash', 'WorkerLocation.hash')}} | +{{Spec2('HTML WHATWG')}} | +Initial definition. | +
{{Compat("api.WorkerLocation.hash")}}
+ +{{ApiRef("WorkerLocation")}}
+ +The host
property of a {{domxref("WorkerLocation")}} object returns the {{domxref("URL.host", "host")}} part of the worker’s location.
string = object.host;+ +
// In a Web worker, on the page https://developer.mozilla.org/en-US/WorkerLocation.host +var result = window.self.host; // Returns:'developer.mozilla.org:80' ++ +
Specification | +Status | +Comment | +
---|---|---|
{{SpecName('HTML WHATWG', 'workers.html#dom-workerlocation-host', 'WorkerLocation.host')}} | +{{Spec2('HTML WHATWG')}} | +Initial definition. | +
{{Compat("api.WorkerLocation.host")}}
+ +{{ApiRef("WorkerLocation")}}
+ +The hostname
property of a {{domxref("WorkerLocation")}} object returns the {{domxref("URL.hostname", "hostname")}} part of the worker’s location.
string = object.hostname;+ +
// In a Web worker, on the page https://developer.mozilla.org/en-US/WorkerLocation.hostname +var result = window.self.hostname; // Returns:'developer.mozilla.org' ++ +
Specification | +Status | +Comment | +
---|---|---|
{{SpecName('HTML WHATWG', 'workers.html#dom-workerlocation-hostname', 'WorkerLocation.hostname')}} | +{{Spec2('HTML WHATWG')}} | +Initial definition. | +
{{Compat("api.WorkerLocation.hostname")}}
+ +{{ApiRef("WorkerLocation")}}
+ +The href
property of a {{domxref("WorkerLocation")}} object returns a {{domxref("USVString")}} containing the serialized {{domxref("URL")}} for the worker’s location.
string = object.href;+ +
// In a Web worker, on the page https://developer.mozilla.org/en-US/WorkerLocation.href +var result = window.self.href; // Returns:'https://developer.mozilla.org/en-US/WorkerLocation.href' ++ +
Specification | +Status | +Comment | +
---|---|---|
{{SpecName('HTML WHATWG', 'workers.html#dom-workerlocation-href', 'WorkerLocation.href')}} | +{{Spec2('HTML WHATWG')}} | +Initial definition. | +
{{Compat("api.WorkerLocation.href")}}
+ +The WorkerLocation
interface doesn't inherit any property, but implements properties defined in the {{domxref("URLUtilsReadOnly")}} interface.
':'
.':'
, and the port of the URL of the script executed in the {{domxref("Worker")}}.'/'
followed by the path of the URL (not including the query string or fragment) of the script executed in the {{domxref("Worker")}}.'?'
followed by the parameters of the URL of the script executed in the {{domxref("Worker")}}.'#'
followed by the fragment identifier of the URL of the script executed in the {{domxref("Worker")}}.The WorkerLocation
interface doesn't inherit any method, but implements methods defined in the {{domxref("URLUtilsReadOnly")}} interface.
{{ApiRef("WorkerLocation")}}
+ +The origin
property of a {{domxref("WorkerLocation")}} object returns the worker’s {{domxref("URL.origin", "origin")}}.
string = object.origin; ++ +
// On this page, returns the origin +var result = self.location.origin; // Returns:'https://developer.mozilla.org:443' ++ +
Specification | +Status | +Comment | +
---|---|---|
{{SpecName('HTML WHATWG', 'workers.html#dom-workerlocation', 'WorkerLocation.origin')}} | +{{Spec2('HTML WHATWG')}} | +Initial definition. | +
{{Compat("api.WorkerLocation.origin")}}
+ +{{ApiRef("WorkerLocation")}}
+ +The pathname
property of a {{domxref("WorkerLocation")}} object returns the {{domxref("URL.pathname", "pathname")}} part of the worker’s location.
string = object.pathname;+ +
// In a Web worker, on the page https://developer.mozilla.org/en-US/WorkerLocation.pathname +var result = window.self.pathname; // Returns:'/en-US/WorkerLocation.pathname' ++ +
Specification | +Status | +Comment | +
---|---|---|
{{SpecName('HTML WHATWG', 'workers.html#dom-workerlocation-pathname', 'WorkerLocation.pathname')}} | +{{Spec2('HTML WHATWG')}} | +Initial definition. | +
{{Compat("api.WorkerLocation.pathname")}}
+ +{{ApiRef("WorkerLocation")}}
+ +The port
property of a {{domxref("WorkerLocation")}} object returns the {{domxref("URL.port", "port")}} part of the worker’s location.
string = object.port;+ +
// In a Web worker, on the page https://developer.mozilla.org/en-US/WorkerLocation.port +var result = window.self.port; // Returns:'80' ++ +
Specification | +Status | +Comment | +
---|---|---|
{{SpecName('HTML WHATWG', 'workers.html#dom-workerlocation-port', 'WorkerLocation.port')}} | +{{Spec2('HTML WHATWG')}} | +Initial definition. | +
{{Compat("api.WorkerLocation.port")}}
+ +{{ApiRef("WorkerLocation")}}
+ +The protocol
property of a {{domxref("WorkerLocation")}} object returns the {{domxref("URL.protocol", "protocol")}} part of the worker’s location.
string = object.protocol;+ +
// In a Web worker, on the page https://developer.mozilla.org/en-US/WorkerLocation.href +var result = window.self.protocol; // Returns:'https:' ++ +
Specification | +Status | +Comment | +
---|---|---|
{{SpecName('HTML WHATWG', 'workers.html#dom-workerlocation-protocol', 'WorkerLocation.protocol')}} | +{{Spec2('HTML WHATWG')}} | +Initial definition. | +
{{Compat("api.WorkerLocation.protocol")}}
+ +{{ApiRef("WorkerLocation")}}
+ +The search
property of a {{domxref("WorkerLocation")}} object returns the {{domxref("URL.search", "search")}} part of the worker’s location.
string = object.search;+ +
// In a Web worker, on the page https://developer.mozilla.org/en-US/docs/WorkerLocation.href?t=67 +var result = window.self.search; // Returns:'?t=67' ++ +
Specification | +Status | +Comment | +
---|---|---|
{{SpecName('HTML WHATWG', 'workers.html#dom-workerlocation-search', 'WorkerLocation.search')}} | +{{Spec2('HTML WHATWG')}} | +Initial definition. | +
{{Compat("api.WorkerLocation.search")}}
+ +{{ApiRef("WorkerLocation")}}
+ +The toString()
stringifier method of a {{domxref("WorkerLocation")}} object returns a {{domxref("USVString")}} containing the serialized {{domxref("URL")}} for the worker’s location. It is a synonym for {{domxref("WorkerLocation.href")}}.
string = object.toString();+ +
// In a Web worker, on the page https://developer.mozilla.org/en-US/WorkerLocation.href +var result = window.self.toString(); // Returns:'https://developer.mozilla.org/en-US/WorkerLocation.href' ++ +
{{Compat("api.WorkerLocation.toString")}}
+ +