【发布时间】:2016-08-21 16:58:05
【问题描述】:
作为我的应用程序的一部分,我需要将 iframe 显示为页面。我需要在页面上提供后退和前进按钮,以便 iframe 可以在其历史记录中后退/前进。
当我尝试时:
$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"
$scope.backiframe@http://localhost:8100/js/controllers.js:1217:16
anonymous/fn@http://localhost:8100/lib/ionic/js/ionic.bundle...
有谁知道如何让 iframe 向后/转发以在 phonegap ionic 混合应用程序中工作?
【问题讨论】:
-
iframe 是否引用了外部 URL?
-
是的 iframe 正在链接和外部 url
标签: javascript angularjs cordova iframe ionic-framework