The fragment, with its leading # — e.g. "#top". Empty string if the URL has no fragment.
The hostname, plus : and the port if one is specified — e.g. "example.com:8080".
The hostname alone, without the port — e.g. "example.com".
The whole URL as a string. Assigning to it replaces the entire URL, throwing a TypeError if the new value cannot be parsed.
ReadonlyoriginThe scheme, hostname and port — e.g. "https://example.com:8080".
The password given before the hostname. Empty string if there is none.
The path, beginning with / — e.g. "/docs/index.html".
The port number as a string — e.g. "8080". Empty string if no port is specified or it is the default for the scheme.
The scheme, with its trailing : — e.g. "https:".
The query string, with its leading ? — e.g. "?q=hello". Empty string if the URL has no query. Assigning replaces the whole query.
ReadonlysearchA live URLSearchParams view of the query string. Changes made through it are reflected in search and href.
The username given before the hostname. Empty string if there is none.
Parses a URL string into its components, and builds URL strings from components. This is the standard Web API
URLclass: MDN documents it in further depth, though only the members declared here are guaranteed to be present.The component properties may be assigned to modify the URL in place; each assignment updates href, percent-encoding characters where the URL syntax requires it. Use searchParams to read and edit the query string.
Instances may be passed directly to PopClip.openUrl and PopClip.share.
Example