1

I faced issue with Iframe in Angular 7. When the history back button is pressed, the browser changes only the iframe and not the entire page, I need to press 2 times the back button to go in the previous page.

HTML

<iframe  #iframe [src]=src class="iframe" id="iframe" style="min-height: 100px;"></iframe>

Component

In component I assigned src like this

 this.src = this.domSanitizer.bypassSecurityTrustResourceUrl('url');

I tried by assigning src with Jquery but it is not working with bypassSecurityTrustResourceUrl.

e kanojia
  • 67
  • 1
  • 2
  • 12
  • history is a stack.. so everytime you click it pops up the most recent record. if your iframe loads after the page (as I assume that is what happening), it sits at the top of the stack. So your first click pops that out, and your second click pops the actual record you want. What you can do is, as soon as page loaded, you can pop the iframe from the history so your back button would have the previous page at the top of your history stack.. – curiousBoy Apr 14 '20 at 04:42
  • Finally, did you find any solutions? I faced same issue. – Fikret Aug 25 '20 at 07:50
  • @Fikret, yes Instead of loading i frame in the HTML We load the iframe using jquery It resolves back issue – e kanojia Sep 15 '20 at 06:36

0 Answers0