cordova-plugin-inappbrowser
cordova-plugin-inappbrowser copied to clipboard
documenting the custom schemes handling
I am not native english so I cant create a pr for this, but we need to documente the lastest changes in custom schemes handling (https://github.com/apache/cordova-plugin-inappbrowser/pull/263 and https://github.com/apache/cordova-plugin-inappbrowser/pull/274)
the things to document: for example to allow whatsapp custom scheme and twitter
- add new config.xml preference with the custom schemes you want to support:
<preference name="AllowedSchemes" value="whatsapp,twitter" />`
- add event listeners customscheme:
inAppBrowserRef.addEventListener('customscheme', function (event) {
//do whatever you want here like:
window.open(event.url, "_system");
});
Thanks @boynet, seems like a reasonable thing to do. Where would you put those in the README/documentation? Feel free to open a new PR even with imperfect English, we can iterate on the wording with suggestions and comments!
@boynet , @janpio I was trying since two days and I could not find a solution. I'm using ionic, cordova, angular5 with typescript. And here my example
this.iab.create(myUrl, "_system");
this.iab.on('loadstart') // will never be triggered
Could you write me a sample that I can follow using _system as target (system browser).
Thanks.
Thanks for mentioning this here. It would be nice if this was added to the documentation, because, to my knowledge, it appears to be the only way on Android to handle redirects back to the app using a custom url scheme. I've used this for the Adyen and Okta oAuth redirect.
As @boynet commented https://github.com/apache/cordova-plugin-inappbrowser/pull/263#issuecomment-442143355 , this works the 1st time a customscheme
is opened. The following times, the callback is never called. This is linked to https://issues.apache.org/jira/browse/CB-13198 and the fix is simple: add the customscheme
event to the _system InAppBrowser after opening it.