Nutrient Web SDK

ReferenceOnOpenUriCallback

Type Alias OnOpenUriCallback

By default, all the URLs on which the user clicks explicitly open as expected but the URLs which open due to a result of JavaScript action are not opened due to security reasons. You can override this behaviour using this callback. If this callback returns true, the URL will open.

For more information, see Configuration#onOpenURI.

Type Alias
Type Signature
type OnOpenUriCallback = (uri: string, isUserInitiated: boolean) => boolean

Example

Render rectangle annotations using their AP stream

NutrientViewer.load({
onOpenURI: (url, isUserInitiated) => {
if (url.startsWith('https://abc.com') && isUserInitiated) {
return true
}

return false;
}
// ...
});

Type Declaration

Parameters

uristring

The URL to open.

isUserInitiatedboolean

Tells you whether the URL is being opened because of user's interaction or not.

Returns

boolean