Error while using InAppBrowser


#1

Hi, I got an error while trying to implement InAppBrowser plugin. This is the error

This is my .ts file

.html file

Hope someone can help me.


#2

hi @naiesah2

Hope this two plug-in install in your Project

$ ionic plugin add --save cordova-plugin-inappbrowser
$ npm install --save @ionic-native/in-app-browser

In .ts file

import { InAppBrowser } from '@ionic-native/in-app-browser';

export class LeagueTablePage {
    constructor (public  iab: InAppBrowser){
    }
    launch(){
      let browser= new  this.iab.create('https://www.google.com','_system','location=true');
      browser.show();      
    } 
}

Hope this will solve your issue.

Feel free to mark it as a solution and you can always like the answer by clicking heart icon.


#3

Thanks for the response. But I got an error when implementing your code.

Also I’m using ionic 2.2.0. Actually I try another solution

cordova.InAppBrowser.open(url,"_system",“location=true”);

but got an error too because it can detect the cordova object.


#4

Hi @naiesah2

Could you try it

 startBrowser(url,type){
    this.platform.ready().then(() => {
        window.open(url, type, 'location=yes');
    });
   
  }

Hope this will work for you. If you find it helpful then you can mark it as a solution. You can always like the answer by clicking on heart icon.