模塊:ionic開發(fā)——瀏覽器打開鏈接功能
在APP應(yīng)用中,我們可能需要點擊圖片打開瀏覽器打開鏈接的一些功能:
第一步、安裝插件:
ionic plugin add cordova-plugin-inappbrowser
第二步、添加點擊事件
$scope.open=function () {
window.open('http://baidu.com', '_blank', 'location=yes');
}
window.open(url, target, options);
1、url: 聲明了要在窗口中顯示的文檔的 URL地址。
2、target: _blank -- 在新窗口中打開鏈接
_self -- 在當(dāng)前窗體打開鏈接,此為默認(rèn)值
_system:在系統(tǒng)的Web瀏覽器中打開。
3、options: 可選,默認(rèn)為: location=yes
如:
window.open('http://baidu.com', '_blank', 'location=yes');
問題:

解決方法:
剛開始省略了 http:// ,結(jié)果自動解析為 https:// 出錯,改成 http:// 即可