Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

355
Visualizações
Iframe messing up browser history - adding current page to history

I have product pages on my site that have an iframe on them. The presence of the iframe is messing up the browser history - the current page gets added to the history stack, and when I click the back button the page remains the same, I have to click twice to get to the actual previous page (and I have to click quickly, or else the page gets added to the stack again). I have isolated this as the problem because when I remove the entire iframe, the issue goes away; it is also resolved when I remove the src on the iframe.

<iframe sandbox="allow-same-origin allow-scripts" class="add-to-cart__iframe" id="addtocartiframe" src="https://buy.website.com/en/addtocart/#/addToCart/109ATCA714-1003R/71cbba730b634200ac437cc3907ed626/en" title="Add to Cart"></iframe>

I tried adding sandbox="allow-same-origin allow-scripts" based on How can I prevent Iframe messing browser's history after interactions with it? but it didn't help.

I know that I could remove the src and use Javascript to update the src only when the button to show the iframe is clicked, however, this would still cause the back button to not work as expected if the iframe button has been clicked, and the client has specifically called that out as an issue (if they go to the page, click the button to open the iframe, and then try to click back, it doesn't work and this is frustrating them)

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda