I am working on an app that requires displaying an iframe as a page. I want to include back and forward buttons on the page so that users can navigate through the history of the iframe.
Here is what I have tried:
$scope.backiframe = function() {
var iframe = document.getElementById('iframe');
iframe.contentWindow.history.go(-1);
}
However, when I add the button and iframe like this:
<a class="button button-positive" ng-click="backiframe()">back</a>
<iframe id="iframe" ng-src="{{trustSrc(url)}}" scrolling="yes"></iframe>
I encounter the following error:
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...
Does anyone know how to make the back and forward functionality work in an Ionic hybrid app using PhoneGap?