Edit this page

up.util up.util.parseURL(the)
JavaScript function

Parses the given URL into components such as hostname and path.

If the given URL is not fully qualified, it is assumed to be relative to the current page.

Example

let parsed = up.util.parseURL('/path?foo=value')
parsed.pathname // => '/path'
parsed.search // => '/?foo=value'
parsed.hash // => ''

Parameters

the stringorURL

URL to parse

Return value

The parsed URL as an object with { protocol, hostname, port, pathname, search, hash } properties.