An object containing { actualUrl, recordUrl }, both relative to the origin.
const { actualUrl, recordUrl } = getURL();
// Meta override
// <meta name="99dev-page" content="https://example.com/about">
// → actualUrl === "/"
// → recordUrl === "/about"
// Hash navigation
// URL: https://example.com/#/products?page=2
// → actualUrl === "/products"
// → recordUrl === "/products"
// History state override
// history.pushState({ url: "/custom-path" }, "", "/products")
// → actualUrl === "/custom-path"
// → recordUrl === "/custom-path"
Resolves the current page URL in two forms:
actualUrl: the path detected from browser navigation (hash/history/pathname)recordUrl: the path that should be persisted, allowing canonical/meta overridesThe record URL is derived using this order of precedence:
<meta name="99dev-page" /><link rel="canonical" />The actual URL honors the configured navigation type:
"hash": useswindow.location.hashwithout the leading#"history": preferswindow.history.state.urlwhen provided"natural"(default): useswindow.location.pathnameWhen
normalizeUrlsis enabled the function removes query parameters, ensures a leading slash, trims trailing slashes, and drops.htmlextensions so both URLs share consistent formatting.