作爲我的應用程序的一部分,我需要顯示一個iframe作爲一個頁面。我需要在頁面上提供後退和前進按鈕,以便iframe可以在其歷史記錄中後退/前進。Phonegap Ionic - Iframe history.back();不工作
當我嘗試:
$scope.backiframe = function() {
var iframe = document.getElementById('iframe');
iframe.contentWindow.history.go(-1);
}
與我的按鈕和iframe: <a class="button button-positive" ng-click="backiframe()">back</a> <iframe id="iframe" ng-src="{{trustSrc(url)}}" scrolling="yes"></iframe>
我得到以下錯誤: Error: Permission denied to access property "history" [email protected]://localhost:8100/js/controllers.js:1217:16 anonymous/[email protected]://localhost:8100/lib/ionic/js/ionic.bundle...
沒有人知道如何讓IFRAME前進/後退到在手機離子混合應用程序中工作?
是iframe中引用外部URL? – Shakespeare
是的iframe正在鏈接和外部URL – AN11
可能重複[錯誤:無法訪問屬性href](http://stackoverflow.com/questions/15703503/error-cant-access-property-href) – Shakespeare