如何从ionic 3打开谷歌浏览器

时间:2021-07-22 04:59:43

标签: cordova ionic-framework

如何从 ionic 3 应用程序打开 google chrome 浏览器? (原生安卓谷歌浏览器)并在其中打开链接

1 个答案:

答案 0 :(得分:0)

安装插件

npm install open-browser -g

将此函数放入您的 .[在此处输入链接描述][1]ts 文件
根据您的要求设置参数:::::

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    
    });
  }

你可以调用::::::

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

它将在 Chrome 中打开您的链接 但是我在使用系统浏览器时遇到的问题是 URL 不能用其中任何一个选项隐藏... 如果需要,请根据项目安装所需的插件。