Ionic 2 InAppBrowser

I have to create the app that can show website.
I have installed cordova plugin InAppBrowser in command prompt.

$cordova plugin add cordova-plugin-inappbrowser

and the ts code is following.

import { Component } from '@angular/core';

import { NavController, Platform } from 'ionic-angular';
import { InAppBrowser } from 'ionic-native';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  constructor(public navCtrl: NavController, public platform: Platform) {
    this.platform.ready().then(() =>{
      open('http://MMM.com', '_blank', 'location = yes');
  
    });
  }
}

The template code is

<ion-header>
  <ion-navbar color="primary">
     <ion-title align="center">Page Title</ion-title>
  </ion-navbar>
</ion-header>    

<ion-content>

</ion-content>

And the result is blank page and some warnings.

Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.
... ... ...

How can I complete that problem?

Are you running in the browser or on a real device?
Are you trying to load the webpage in the template? That wont work.

Also, your code wont work either. To open a new InAppbrowser method, you have to use the correct method.

1 Like