title: How to manipulate history outside of an iframe
body: <p>I'm writing a simple angular app, and I want to make a browser like thing: a input box user can type url, an iframe to display content of the url, a button which user can press to go back.</p>
  
  <p>I use $sce to ng-src in iframe to accept any website user input. But cannot implement history back function because of CORS problem.</p>
  
  <p>Is there any possibility to achieve it? Thanks</p>
  
  <p>JS</p>
  
  <pre><code>$scope.testurl = $sce.trustAsResourceUrl("http://www.baidu.com");
  $scope.backPage = function () {
    var ifr = document.getElementById("myIframe");
    ifr.contentWindow.history.back();
  }
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;ion-view view-title="Account"&gt;
    &lt;ion-content&gt;
      &lt;div ng-click="backPage()"&gt;BACK&lt;/div&gt;
      &lt;iframe id="myIframe" style="height:500px;width:100vw" ng-src="{{testurl}}"&gt;&lt;/iframe&gt;
    &lt;/ion-content&gt;
  &lt;/ion-view&gt;
  </code></pre>
  
  <p>Error</p>
  
  <pre><code>Error: Blocked a frame with origin "http://localhost:8101" from accessing a cross-origin frame.
      at Error (native)
      at Scope.$scope.backPage (http://localhost:8101/js/controllers.js:32:24)
      at fn (eval at compile (http://localhost:8101/lib/ionic/js/ionic.bundle.js:27638:15), &lt;anonymous&gt;:4:215)
      at http://localhost:8101/lib/ionic/js/ionic.bundle.js:65427:9
      at Scope.$eval (http://localhost:8101/lib/ionic/js/ionic.bundle.js:30395:28)
      at Scope.$apply (http://localhost:8101/lib/ionic/js/ionic.bundle.js:30495:25)
      at HTMLDivElement.&lt;anonymous&gt; (http://localhost:8101/lib/ionic/js/ionic.bundle.js:65426:13)
      at defaultHandlerWrapper (http://localhost:8101/lib/ionic/js/ionic.bundle.js:16787:11)
      at HTMLDivElement.eventHandler (http://localhost:8101/lib/ionic/js/ionic.bundle.js:16775:9)
      at triggerMouseEvent (http://localhost:8101/lib/ionic/js/ionic.bundle.js:2953:7)
  </code></pre>