Constructor
new URN(urlStr, baseUrlStr)
Parameters
Name | Type | Description |
---|---|---|
urlStr | string | string containing URL to construct/parse |
baseUrlStr | string | ignored; must be undefined or empty |
Property Index
Name | Description |
---|---|
hash | Contains the hash portion of this URI, if any. |
host | Contains the hostname portion of this URI, if any. |
hostname | Contains the domain portion of this URI, if any. |
href | Contains the canonical serialization of the input urlStr, resolved wrt to baseUrlStr if supplied. |
is_invalid | Is non-empty/contains an error msg on malformed URI. |
origin | Contains the serialization of the origin (as per RFC 6454) from the input URI, if any. |
password | Contains the password component of this URI, if any. |
pathname | Contains the pathname of this URI, if any. |
port | Contains the port of this URI, if any. |
protocol | Contains the protocol (lowercase) of this URI, including the terminating colon. |
search | Contains the search portion of this URI, if any. |
username | Contains the username component of this URI, if any. |
Method Index
Name | Description |
---|---|
reset | Resets internal URI components. |
set_href | Sets href (the URL string), triggering re-parsing of the URI and re-populating component fields. |
Member Details
- hash :string
-
Contains the hash portion of this URI, if any.
This is the fragment with "#" prepended to it.
- host :string
-
Contains the hostname portion of this URI, if any.
- hostname :string
-
Contains the domain portion of this URI, if any.
- href :string
-
Contains the canonical serialization of the input urlStr, resolved wrt to baseUrlStr if supplied.
- is_invalid :string
-
Is non-empty/contains an error msg on malformed URI.
- origin :string
-
Contains the serialization of the origin (as per RFC 6454) from the input URI, if any.
- password :string
-
Contains the password component of this URI, if any.
- pathname :string
-
Contains the pathname of this URI, if any.
- port :string
-
Contains the port of this URI, if any.
- protocol :string
-
Contains the protocol (lowercase) of this URI, including the terminating colon.
Restrictions of which protocols are considered valid apply.
- reset()
-
Resets internal URI components.
- search :string
-
Contains the search portion of this URI, if any.
This is the query with "?" prepended to it.
- set_href(urlStr)
-
Sets href (the URL string), triggering re-parsing of the URI and re-populating component fields.
Parameters
Name Type Description urlStr string
- username :string
-
Contains the username component of this URI, if any.