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

233
Vistas
using postMessage via localhost and server

I have a problem with getting the contents of website X from website Y I have localhost:3000 and http://levshapiro.com

I watched a video how to do it and wrote this:

// localhost:3000 ( P.S. built on React ) 
function App() {
  let url = "http://levshapiro.com";

  useEffect(() => {
    let iframe = document.getElementById("iframe");
    
    iframe.contentWindow.postMessage("HEJ", "*");
  }, [])

  return (
    <>
      <div className="console">
        <span id="website_url">Website: {url}</span>
      </div>
      <iframe src={url} id="iframe" title="something"/>
    </>
  )
}


// http://levshapiro.com

window.addEventListener("message", function(message) {
     alert(message.data)
})

// + In HTML "<h1>Hello World!</h1>"

In this video ( https://www.youtube.com/watch?v=i9nFBZ-MiuQ ) it worked, but for me it didn't. Could someone tell me why?

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