對於需要使用插件離子開放外部URL這兩個Android和iOS兼容:
科爾多瓦插件添加科爾多瓦 - 插件:
使用下面的管道上安裝科爾多瓦 - 插件,inappbrowser -inappbrowser
之後把這個代碼在HTML文件中:
<button class="button" ng-click="openurl('https://..........')">
Click here
</button>
然後調用通過控制器單擊事件:
.controller('MyCtrl', function($scope, $cordovaInAppBrowser) {
var options = {
location: 'yes',
clearcache: 'yes',
toolbar: 'no'
};
$scope.openurl = function (url) {
window.open(url, '_system', options);
}
OR
$scope.openurl = function (url) {
$cordovaInAppBrowser.open(url, '_system', options);
}
})
在config.xml文件
<allow-intent href="*" />
<allow-navigation href="*" />
<allow-intent href="http://*/*" launch-external="yes" />
<allow-intent href="https://*/*" launch-external="yes" />
<feature name="StatusBar">
<param name="ios-package" onload="true" value="CDVStatusBar" />
</feature>
也可以修改進一步參考你可以通過: https://github.com/apache/cordova-plugin-inappbrowser
你有沒有試過人行橫道? – sam
我只是2-3天的生產不能嘗試任何新的東西。 – MobileEvangelist