Namespace: parseUrl

just.parseUrl(urlopt) → {url_parts}

Parses url without checking if it's a valid url. Note that this function uses window.location to make relative urls, so weird values in there will give weird results.
Source:
just.js, line 1480

Parameters:

NameTypeDefaultDescription
url
[optional]
urlwindow.location.hrefA relative, an absolute or a blob url.

Returns:

Type
url_parts

Examples

Example 1: An absolute url:
just.parseUrl(window.location.href);
Example 2: A relative url:
just.parseUrl('/?a#c?d'); // "/" is the pathname, "?a" the search and "#c?d" the hash.
Example 3: A blob url:
just.parseUrl('blob:'); // Same as 'blob:' + `window.location.href`
Example 4: Some good-to-know urls:
just.parseUrl(); // Same as `window.location`.
just.parseUrl('a'); // Something that doesn't start with "/", "?", or "#" is evaluated as a host.
just.parseUrl('a:b'); // "a:b" is a host, since "b" is not a number.
just.parseUrl('//'); // evals as the current origin.
just.parseUrl('blob://'); // Same as 'blob:' + `window.location.origin`.
// [...]