Deeplinking and redirects in InAppBrowser

Hello! I have an application, which opens InAppBrowser for performing auth, then redirects to internal link like myapp://example.com/login/TOKEN_HERE. But Android says ERR_UNKNOWN_URL_SCHEME. If try the same, but from regular browser it open an app correctly.
Here the how i open the link:

this.iab.create('https://example.com/login', '_self', {
  hardwareback: 'yes',
  hidenavigationbuttons: 'yes',
  hideurlbar: 'yes',
});

Maybe it will be helpful for other users.
Currently there is no way to do that with target != '_system'. So done it with workaround:

const browser = this.iab.create('https://example.com/login');

browser.on('loaderror').subscribe(event => {
  if (event.message === 'net::ERR_UNKNOWN_URL_SCHEME') {
    browser.close();
    this.iab.create(event.url, '_system');
  }
});
1 Like

This error is appeared because the WebView can’t recognize the URL Scheme,for example, the WebView will usually recognize only http and https, anything other than these. So WebView cannot parse it to right place, we should use intent to redirect the url. for example – intent://,market://,app://,mail:// etc will not be recognized by webview unless we add a handler to handle these url scheme or by disabling these schemes and only load http and https schemes.

This error has no any specific solution till now. Android user and PC user all are facing this error which needs to be sought out. There’s a long-standing bug in Chromium regarding how links without protocols are handled. It occasionally is patched, but seems to keep resurfacing. In some cases, prefixing your links with http:// (or https://) should resolve the issue for you.

Also, in some cases, try to add target=“_blank” in your URL Scheme/Code. for example:

<a href="mailto:my@email.com" target="_blank">Link Text</a>