Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

85
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda