Skip to content

Instantly share code, notes, and snippets.

@wedgybo
Last active December 24, 2015 01:24
Show Gist options
  • Save wedgybo/7ee11834cc64b3f452f3 to your computer and use it in GitHub Desktop.
Save wedgybo/7ee11834cc64b3f452f3 to your computer and use it in GitHub Desktop.
if ('cordova' in window) {
// Create a sticky event for handling the app being opened via a custom URL
cordova.addStickyDocumentEventHandler('handleopenurl');
}
function handleOpenURL (url) {
cordova.fireDocumentEvent('handleopenurl', { url: url });
};
@wedgybo
Copy link
Author

wedgybo commented Jun 10, 2015

Just saw this! Glad it helped out. There were a few typos previously that I think might have been causing some issues 😞

@symbiat
Copy link

symbiat commented Jun 12, 2015

@jonill @wedgybo Where is handleExternalOpenURL defined? And did you rename the event from handleopenurl to handleurl throughout your app?

@konami99
Copy link

Hi,

I couldn't get it working on cold start on android. handleOpenURL(url) didn't get called. I was testing push notification that contains a deep link. Here is the flow:

  1. Receive push notification, click on it
  2. App is launched
  3. Landing page loaded. Didn't go to the page I specified in deep link.

I think it's because handleOpenURL() isn't there yet, when I click push notification?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment