In AppBrowser dosent work on Android Device?

hello,

in my blank ionic 2 app i added InAppBrowser plugin by this command :-

$ ionic plugin add cordova-plugin-inappbrowser

it’s all ready added into the application, here is my home.ts file :-

import {Component} from '@angular/core';
import {NavController} from 'ionic-angular';
import {InAppBrowser} from 'ionic-native';

@Component({
  templateUrl: 'build/pages/home/home.html'
})
export class HomePage {
    constructor(public navCtrl: NavController) {

    }

    login () {
        return new Promise(function(resolve, reject) {
            let browser = InAppBrowser.open('https://ionic.io', '_system');
            console.log("done");
        });
    }
}

in html file i called it that:-

<button (click)="login()">Login</button>

results! … in browser console i have done, but in mobile device it opens the web site in traditional google chrome app not in app browser ?

i think i missed a small thing, so any one can help me ?

Hi,

You can use

'_blank' 

or

'_self'

I hope thats helps you. :smile:

Best regards,
chmmu

1 Like

Hi sir.
Instead of '_system ' right ? or where ? :smile:

Yes instead of ‘_system’ :smiley: For more options and details see https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/

_self: Opens in the Cordova WebView if the URL is in the white list, otherwise it opens in the InAppBrowser
_blank: Opens in the InAppBrowser
_system: Opens in the system’s web browser

1 Like

good morning mate,

i all ready tried '_blank' now and it working! with vibrate and flashlight plugins in the same app withe less lines of code awesome! ionic 2 will destroyed the world i’m sure :smiley:
but i wanna thank you for your valuable replay its learned me more :wink: