InAppBrowser does not work

My code is very simple. I write using typescript. Here is my home.ts:

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 = new InAppBrowser('https://ionic.io', '_system');
            // ... code ...
        });
    }
}

But typescript show me this error:

TypeScript error: /home/eugene/Documents/Projects/ExampleProject/app/pages/home/home.ts(16,27): Error TS2346: Supplied parameters do not match any signature of call target.

He writes about this line:
let browser = new InAppBrowser('https://ionic.io', '_system');

What is my problem?

1 Like

You are missing the 3rd parameter, options, to the call to inAppBrowser. This should work:

let browser = new InAppBrowser(‘https://ionic.io’, ‘_system’, ‘’);

or you can hide the nav bar and zoom if you don’t want them:

let browser = new InAppBrowser(‘https://ionic.io’, ‘_system’, ‘location=no,zoom=no’);

This worked for me:

let browser = InAppBrowser.open(‘https://ionic.io’, ‘_system’);

Docs needs some work it seems.

Having the same problem , i can’t use InAppBrowser.open() because i need a browser object so i can use browser.on() to listen to event later. Here are my code :slight_smile:

  let ref = new InAppBrowser(this.restService.API_BASE_URL+ '/mauth/login/' + requestToken, '_blank','location=no');
    ref.on('loadstop').subscribe(event => {
      console.log(event);
      if (event.url.match("close-browser")) {
        ref.close();

Any idea everyone ? :slight_smile:

I’m having exactly the same problem.

@tunguyen_bhtech InAppBrowser.open() returns a ref. aswell.

let browser = InAppBrowser.open('http..', '_blank');
browser.addEventListener('loadstart', (event) => {..