Skip to main content

switchToCurrentVersionUrl

Callable

  • switchToCurrentVersionUrl(pageUrl: string | URL): string

  • URL that returns this browser to the current version of the app: the given page URL with an empty _twf_app_version= as its only _twf_app_version query parameter. Loading it clears the pin and lands back on the page, now running the current version.

    Build it at the moment of navigation. In an app that routes on the client, a URL built earlier names whatever route was current then. A relative URL is resolved against location.href, the route the browser is on now, so a router-supplied path works as well as location.href itself.

    Only the query is edited, since the gateway honours the parameter on any top-level navigation whatever the path looks like. Two details mirror what the gateway does with the parameter. Existing pairs are matched by their decoded name, case-insensitively, because the gateway matches that way and a surviving second pair would make it read both values as one and clear nothing. Every other pair is carried over byte for byte, keeping the percent-encoding the app produced, because the gateway strips the version parameter textually and hands the rest of the query on as it arrived.


    Parameters

    • pageUrl: string | URL

    Returns string