NavigationHandler

NavigationHandler

A handler which can take over navigation to URLs opened by the SDK, e.g. to route through a single-page app's client-side router instead of loading a new page

Methods

openUrl(url, isUserInteraction) → {boolean|Promise.<boolean>}

Called when the SDK opens a URL, e.g. from a Scene's open_external_url_action. Return true once you have handled the navigation. Returning false, or throwing, lets the SDK open the URL as it normally would, using window.open, in a new browsing context unless components.inAppAutomation.openUrlsInSameContext is true.

Decline without first awaiting other work, such as a network request. Browsers only allow window.open shortly after a user interaction, so if the SDK's fallback opens the URL too late the popup blocker can block it.

Parameters:
Name Type Description
url string

the URL to open

isUserInteraction boolean

whether the navigation was the direct result of a user interaction, e.g. a button tap

Returns:
Type:
boolean | Promise.<boolean>