Search code examples
ionic-frameworkionic4

Ionic in app browser opening url in other browser


I need to open website in app not in other browser but its always opening in google chrome app.

  constructor(private iab: InAppBrowser) {

    const options: InAppBrowserOptions = {
      zoom: 'no',
      fullscreen: "yes",
      hidenavigationbuttons: "no",
      toolbar:'no',
      hideurlbar: 'yes',
    }


  const browser = this.iab.create('https://surveyor.igiinsurance.com.pk/', '_blank',{ toolbar: 'no',  hideurlbar: 'yes',
    fullscreen: "yes",location:"no", options});
    browser.show(); 
  }

}

Solution

  • Try to use it after platform is ready.

      constructor(public platform: Platform, private iab: InAppBrowser) {
    
        const options: InAppBrowserOptions = {
          zoom: 'no',
          fullscreen: "yes",
          hidenavigationbuttons: "no",
          toolbar:'no',
          hideurlbar: 'yes',
        }
    
         this.platform.ready().then( () => {
            const browser = this.iab.create("https://surveyor.igiinsurance.com.pk", '_self',{ toolbar: 'no',  hideurlbar: 'yes',
           fullscreen: "yes",location:"no", options});
         })
    
      }
    

    Code is already tested :)