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.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
url [optional] | url | window.location.href | A relative, an absolute or a blob url. |
Returns:
- Type
- url_parts
Examples
just.parseUrl(window.location.href);
just.parseUrl('/?a#c?d'); // "/" is the pathname, "?a" the search and "#c?d" the hash.
just.parseUrl('blob:'); // Same as 'blob:' + `window.location.href`
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`.
// [...]