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

84
Visualizações
Can you target an element in an iFrame from the same site?

What I'm trying to do is to is to open the minicart url in an iframe on a page so i can get the basket total from the cart. i've been able to do this, but when i try to target what's on the iframe i'm unable to do so. On the site when i console.log "pre" i do see that in the html collection the innerHTML does display what is outputted. Any idea how or if i would be able to target this?

var iframevar = document.getElementById('freeGiftiFrame');
var elmnt = iframevar.contentWindow.document.getElementsByTagName("pre");
console.log(elmnt)
<iframe id="freeGiftiFrame" class="cartPopout" name="iframe_a" height="100px" width="100%">
  <html>
  <head></head>
    <body>
      <pre style="word-wrap: break-word; white-space: pre-wrap;">
      {"miniCartCount": 1, "miniCartPrice": "€&nbsp;30,00"}
      </pre>
    </body>
  </html>
</iframe>

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

For anyone with the issue adding in = sandbox="allow-same-origin allow-scripts" does the trick for me

about 4 years ago · Juan Pablo Isaza Relatório
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