The URL Library contains fourteen functions designed to manipulate URLs. For example, these functions can be used to return specific information about relative and absolute URLs, handle escape characters, create absolute URLs, and validate a URL syntax.
The syntax of a URL is: scheme://host:port/path;parameters$query#fragment
You can use the following functions to get the various portions of the URL:
Portion | Function |
---|---|
scheme | getScheme(url) |
host | getHost(url) |
port | getPort(url) |
path | getPath(url) |
parameters | getParameters(url) |
query | getQuery(url) |
fragment | getFragment(url) |
Syntax: URL.escapeString(string)
Replaces special characters with hexadecimal escape sequences.
Syntax: URL.getBase()
Returns an absolute URL.
Syntax: URL.getFragment(url)
Returns the fragment portion of the URL.
Syntax: URL.getHost(url)
Returns the host portion of the URL.
Syntax: URL.getParameters(url)
Returns the parameter portion of the URL.
Syntax: URL.getPath(url)
Returns the path portion of the URL.
Syntax: URL.getPort(url)
Returns the port portion of the URL.
Syntax: URL.getQuery(url)
Returns the query portion of the URL.
Syntax: URL.getReferer()
Returns the smallest relative URL.
Syntax: URL.getScheme(url)
Returns the scheme portion of the URL.
Syntax: URL.isValid(URL)
Determines if the syntax of the URL is correct.
Syntax: URL.loadString(url, contentType)
Returns the content type based upon the provided absolute URL and content type/subtype.
Syntax: URL.resolve(baseUrl, relativeUrl)
Returns an absolute URL given a base and embedded URL.
Syntax: URL.unescapeString(string)
Replaces hexadecimal escape sequences with the special characters they represent.