The URL interface represents an object providing static methods used for creating, parsing, and manipulating URLs.
hash: string
The hash property of the URL interface is a string that starts with a #
and is followed by the fragment identifier of the URL.
It returns an empty string if the URL does not contain a fragment identifier.
host: string
The host
property of the URL interface is a string that includes the URL.hostname
and the URL.port
if one is specified in the URL includes by including a :
followed by the port number.
hostname: string
The hostname
property of the URL interface is a string that represents the fully qualified domain name of the URL.
href: string
The href
property of the URL interface is a string that represents the complete URL.
origin: string
The origin
property of the URL interface is a string that represents the origin of the URL, that is the URL.protocol
, URL.host
, and URL.port
.
password: string
The password
property of the URL interface is a string that represents the password specified in the URL.
pathname: string
The pathname
property of the URL interface is a string that represents the path of the URL.
port: string
The port
property of the URL interface is a string that represents the port of the URL if an explicit port has been specified in the URL.
protocol: string
The protocol
property of the URL interface is a string that represents the protocol scheme of the URL and includes a trailing :
.
search: string
The search
property of the URL interface is a string that represents the search string, or the query string, of the URL.
This includes the ?
character and the but excludes identifiers within the represented resource such as the URL.hash
. More granular control can be found using URL.searchParams
property.
searchParams: URLSearchParams
The searchParams
property of the URL interface is a URL.URLSearchParams
object that represents the search parameters of the URL.
username: string
The username
property of the URL interface is a string that represents the username of the URL.