This feature is experimental. Please share your experiences so we know what to keep or change.
Returns whether the given URL matches the current browser location.
location.hostname // => '/path'
up.history.isLocation('/path') // => true
up.history.isLocation('/other') // => false
By default, a trailing #hash
will be ignored for the comparison. A ?query
string will not:
location.hostname // => '/path'
up.history.isLocation('/path#hash') // => true
up.history.isLocation('/path?query') // => false
The given URL is normalized, so any URL string pointing to the browser location will match:
location.hostname // => '/current-host'
location.pathname // => '/foo'
up.history.isLocation('/foo') // => true
up.history.isLocation('http://current-host/foo') // => true
up.history.isLocation('http://otgher-host/foo') // => false
The URL to compare against the current browser location.
This can be a either an absolute pathname (/path
), a relative filename (index.html
) or a fully qualified URL (https://...
).
Whether to consider #hash
fragments in the given or current URLs.
When set to false
this function will consider the URLs /foo#one
and /foo#two
to be equal.