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

95
Vistas
PostMessage get iframe value

I have two servers ( for example: localhost:3000 and http://example.com ). In the localhost, I have an iframe that is connected to http://example.com ( through src attribute ), so I've sawed a lot of answers that showed how to get data, but I didn't saw any that showed how to save it.

<!-- localhost:3000 -->
<iframe src="http://example.com" id="example"></iframe>

<script>
  let iframeCONTENT = null;
  // ^^^^ how do I fill this variable with the content of iframe
  
  let iframe = document.querySelector("#example");
  let iframeDocument = iframe.contentWindow || iframe.contentDocument || iframe.contentDocument;
  
  iframeDocument.postMessage("", "*")
</script>

<!-- http://example.com -->

 <h1>Hello World!</h1>
 <p>Blabla!</p>

<script>
    window.addEventListener("message", (e) => {
       console.log(document.body)
    }, false)
</script>

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