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
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.
| Property | Description |
|---|---|
url read-only | The full URL from the system, as is |
scene read-only | Which scene the system handed this URL to |
sourceApplication read-only | The 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
| ObjC | JS |
|---|---|
UIOpenURLContext.URL, NSUserActivity.webpageURL | e.url |
UIOpenURLContext.options.sourceApplication | e.sourceApplication |