Reputation: 1004
I got a page that displays external content in a iframe. The content is displaying fine, but when the content of the iframe is loaded another copy of the current page is added to browser history. This causes issues with the browser back button functionality.
I get the path to the content depending on a selected language and then get a path from a resource token.
iframe
<iframe ng-if="path" style="height: 90%; background-color: transparent" allowtransparency="true" class="w-full" ng-src="{{path}}" name="storyFrame" frameborder="0"></iframe>
path loading
$http.get(LRM.getUrl('scormToken', scope.selectedLang.scorm_package.resource_token))
.success(function (response) {
scope.path = response;
}).error(function (response) {
toaster.pop('error', '', 'Could not fetch scorm package');
});
The question is,how do i load iframe content without adding to browser history?
Upvotes: 3
Views: 997
Reputation: 61
Try to use
scope.path = $sce.trustAsResourceUrl(response)
and include $sce in controller. Im not sure on this, but i know angular sometimes has problems with ng-src and iframes
EDIT:
I found out now that my iFrame is acting same as your, i added new variable, lets call it showIframe, before i change src i set it to false and after i change src set this to true (in timeout without ms number - auto), so i frame is removed and added to DOM and history is not changed.
Upvotes: 1