Search code examples
cordovaionic-framework

How to open google chrome browser from ionic 3


How to open google chrome browser from ionic 3 app ? ( native android google chrome ) and open link in that


Solution

  • Install plugin

    npm install open-browser -g
    

    Put this Function in your .[enter link description here][1]ts file
    Set Parameters according to your requirements :::::

    openWithSystemBrowser(url: string) {
        console.log('in system browser');
    
        let target = "_system";
        this.InAppBrowser.create(url, target, {
          location: 'yes',//Or 'no' 
          hidden: 'no', //Or  'yes'
          clearcache: 'yes',
          hideurlbar: 'yes',
          clearsessioncache: 'yes',
          zoom: 'yes',//Android only ,shows browser zoom controls 
          hardwareback: 'yes',
          mediaPlaybackRequiresUserAction: 'no',
          shouldPauseOnSuspend: 'no', //Android only 
          closebuttoncaption: 'Close', //iOS only
          disallowoverscroll: 'no', //iOS only 
          toolbar: 'yes', //iOS only 
          enableViewportScale: 'no', //iOS only 
          allowInlineMediaPlayback: 'no',//iOS only 
          presentationstyle: 'pagesheet',//iOS only 
          fullscreen: 'yes',//Windows only    
        });
      }
    

    you can call ::::::

     let Path = 'https://www.google.com/';
     this.openWithInAppBrowser(path);
    

    it will Open your link in Chrome But I am having issue of using system Browser is that URL can't be hide with any of them Options... If Required do install required Plugins according to project.