我在iPad上的Ionic應用程序出現問題。 當我打開鏈接什麼是模板編碼:Ionic:在iOS設備上顯示Web內容
<a ng-href="https://stackoverflow.com/questions" target="_self"
然後我得到的全屏瀏覽器中查看什麼,甚至覆蓋本機最上面一欄 - 看screanshot:
如何獲得後退按鈕顯示在該視圖中有適當的標題欄? 可以很容易地顯示PDF/DOC文件?
我在iPad上的Ionic應用程序出現問題。 當我打開鏈接什麼是模板編碼:Ionic:在iOS設備上顯示Web內容
<a ng-href="https://stackoverflow.com/questions" target="_self"
然後我得到的全屏瀏覽器中查看什麼,甚至覆蓋本機最上面一欄 - 看screanshot:
如何獲得後退按鈕顯示在該視圖中有適當的標題欄? 可以很容易地顯示PDF/DOC文件?
您可以使用inappbrowser插件:
https://github.com/apache/cordova-plugin-inappbrowser
這個插件的選項location=yes
顯示帶有關閉按鈕的位置吧。
希望它有幫助。
在此之後的步驟給了我正確的網頁內容中離子處理(甚至是PDF/ODT):
ionic plugin add cordova-plugin-inappbrowser
添加引用ngCordova
到app.js
,如:
angular.module('starter', [
'ionic',
'restangular',
'ngCordova',
添加ngCordova源index.html
:
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
然後改變鏈接從:
<a ng-href="https://stackoverflow.com/questions" target="_self"> link </a>
與顯示屬性鏈接(參見https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/)
<a ng-href="https://stackoverflow.com/questions"
onclick="window.open(this.href,
'_blank',
'location=yes,toolbarposition=top,closebuttoncaption=BACK');
return false;"
>Link</a>
或者使用在綁定到HTML控制器中的功能(可能不具有重定向工作一樣好上面的例子):
<button type="button" class="item" ng-click="openBrowser()">OPEN BROWSER</button>
var options = {
location: 'yes',
closebuttoncaption: 'BACK',
toolbarposition: 'top'
};
$scope.openBrowser = function() {
$cordovaInAppBrowser.open('http://google.com', '_self', options)
.then(function (event) {
// success
})
.catch(function (event) {
// error
});
};
解決方案與基金的棘手使用this.href
這裏https://www.thepolyglotdeveloper.com/2014/07/launch-external-urls-ionicframework/#comment-2175484195
Downvoter也許有一些評論,然後投票? – abrasadera