Returns whether the given URL matches the current browser location.
location.pathname // => '/path'
up.history.isLocation('/path') // result: true
up.history.isLocation('/other') // result: false
By default, a trailing #hash and a ?query string are considered for the comparison.
To ignore the #hash, pass { hash: false }:
location.pathname // => '/path'
up.history.isLocation('/path#hash') // result: false
up.history.isLocation('/path#hash', { hash: false }) // result: true
up.history.isLocation('/path?query') // result: false
The given URL is normalized, so any URL string pointing to the browser location will match:
location.hostname // result: 'current-host'
location.pathname // => '/foo'
up.history.isLocation('/foo') // result: true
up.history.isLocation('http://current-host/foo') // result: true
up.history.isLocation('http://other-host/foo') // result: false
The URL to compare against the current browser location.
This can be 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.
Whether the browser is currently at the given location.
Tip Your coding agent can search these docs locally with the Unpoly agent skill