Returns a normalized version of the given URL string.
Two URLs that point to the same resource should normalize to the same string.
The main purpose of this function is to normalize two URLs for string comparison:
up.util.normalizeURL('http://current-host/path') === up.util.normalizeURL('/path') // result: true
By default the hostname is only included if it points to a different origin:
up.util.normalizeURL('http://current-host/path') // result: '/path'
up.util.normalizeURL('http://other-host/path') // result: 'http://other-host/path'
Relative paths are normalized to absolute paths:
up.util.normalizeURL('index.html') // result: '/path/index.html'
You may pass options to exclude URL components from the normalized string:
up.util.normalizeURL('/foo?query=bar', { query: false }) => '/foo'
up.util.normalizeURL('/bar#hash', { hash: false }) => '/bar'
http and https schemes are supported.Whether to include protocol, hostname and port in the normalized URL.
When set to 'cross-domain' (the default), the host is only included if it differ's from the page's hostname.
The port is omitted if the port is the standard port for the given protocol, e.g. :443 for https://.
Whether to include an #hash anchor in the normalized URL.
Whether to include a ?query string in the normalized URL.
Whether to include a trailing slash from the pathname.
The normalized URL.