Skip to content

OpenURLEvent ​

OpenURLEvent represents one occurrence of "this app was opened by a URL". It is the event object of the openurl event on application, carrying the URL, which scene it was handed to, and which app it came from.

Both kinds of source use it: custom schemes (myapp://…) and universal links (https://…).

Inheritance: Event → OpenURLEvent

Constructor ​

OpenURLEvent()

Construct one yourself to simulate an open in tests.

Instance properties ​

Also inherits properties from Event. For openurl fired by the runtime, cancelable is false.

PropertyDescription
url read-onlyThe full URL from the system, as is
scene read-onlyWhich scene the system handed this URL to
sourceApplication read-onlyThe bundle ID of the source app

Examples ​

js
application.addEventListener('openurl', (e) => {
  console.log(e instanceof OpenURLEvent, e.url);
});

Effect (not verified in the simulator): When the app is opened by myapp://orders/42, prints true myapp://orders/42.

Corresponding iOS API ​

ObjCJS
UIOpenURLContext.URL, NSUserActivity.webpageURLe.url
UIOpenURLContext.options.sourceApplicatione.sourceApplication

See also ​