离子2 InAppBrowser网址无法打开

问题描述:

我正在使用Ionic 2并试图用cordova InAppBrowser打开外部链接。离子2 InAppBrowser网址无法打开

launch(url) { 
    this.platform.ready().then(() => { 
    InAppBrowser.open(url, "_system", "location=yes"); 
    console.log("link viewed"); 
    }); 
} 

但是,当我在手机上测试应用程序时,这并未打开链接。此外,当我把它改成这样cordova.InAppBrowser.open(url, "_system", "location=yes");其与语法错误说找不到cordova

window.open(url, "_system", "location=yes");工作正常的浏览器返回它返回在控制台Your current usage of the InAppBrowser plugin is depreciated as of [email protected] Please check the Ionic Native docs for the latest usage details.

任何人都知道更新的方式让InAppBrowser打开?

经过几个小时,深入了解文件,我发现原因。

launch(url) { 
    this.platform.ready().then(() => { 
    new InAppBrowser(url, "_system", "location=yes"); 
    console.log("link viewed"); 
    }); 
} 
+0

lols我发现在2个薄荷糖中。 –

+0

是的,我只发现了以前的语法离子2以前仍在开发中 – SGhaleb

+1

良好的工作继续下去...请改善您的答案,然后我会删除我的一个 –

InAppBrowser

安装命令

$ ionic plugin add cordova-plugin-inappbrowser 

使用

import {InAppBrowser} from 'ionic-native'; 
let browser = new InAppBrowser('https://ionic.io', '_system'); 

这里是official documentation