I follow this http://ionicframework.com/docs/native/in-app-browser/ document for use inappbrowser and try with below steps :
1- install
ionic cordova plugin add cordova-plugin-inappbrowser
npm install --save @ionic-native/in-app-browser
2 - Add this plugin to app.module.ts provider
3 - add to constructor :
constructor(private iab: InAppBrowser) { }
4- and use it in launch method like this :
import { InAppBrowser,InAppBrowserEvent} from '@ionic-native/in-app-browser';
launch(urlc){
let url = 'https://example.com/';
let browser = this.iab.create(url, '_blank', 'location=yes');
browser.on('loadstart').subscribe((ev: InAppBrowserEvent) => {
this.close_status=true;
});
}
but when serve and call launch method I see this error :
Runtime Error
browser.on(...).subscribe is not a function
InAppBrowser
is a cordova plugin, and because of that, it's not available when running the app in the browser with ionic serve
.
Try to run the app on a simulator / real device to use the plugin.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With