【发布时间】:2021-09-29 09:56:44
【问题描述】:
如何从 ionic 3 应用程序打开 google chrome 浏览器? (原生 android google chrome)并在其中打开链接
【问题讨论】:
如何从 ionic 3 应用程序打开 google chrome 浏览器? (原生 android google chrome)并在其中打开链接
【问题讨论】:
安装插件
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 不能被它们中的任何一个选项隐藏... 如果需要,请根据项目安装所需的插件。
【讨论】: