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

107
Vistas
How to share data between cross origin local Storage from html to react iFrame?

i have a page Data.html hosted on "http://127.0.0.1:5501/Data.html" .This html page has 100*100 table row. I have react app hosted on http://localhost:5500/ in which i am displaying this html page.

  htmlPage:
'<iframe width="100%" height="100%" scrolling="no" frameborder="no" allow="autoplay" src="http://127.0.0.1:5501/Data.html"></iframe>'

};

return (
<div className="App">

  <Iframe iframe={demos["htmlPage"]} allow="autoplay" className="ifr1" sandbox="allow-scripts" />
  {/* <div className="div1"></div> */}


  {showModal === true ? <Example className="i am here" showModal={showModal} hideModal={hideModal} ch={ch} GD={GD} /> : <></>}
</div>
);
}
 function Iframe(props) {
return (
<div className="ifram"
  dangerouslySetInnerHTML={{ __html: props.iframe ? props.iframe : "" }}
  />
);
}

Data.html cross origin part:

function FunName(paramName) {
       

        
        localStorage.setItem("chan", paramName);


         window.postMessage(data2, "*");





    }

its perfectly displaying Data.html page.Now i want to click on one of row in iframe and get id of td on iframe domain which is http://localhost:5500/ id domain is same i am getting the id using localStorage.But when domain is different i id is stored on http://127.0.0.1:5501 localstorage.but unable to get in localstorage of http://localhost:5500/ (react app) am unable to get id.i also try to use Postmessage method its also not displaying id.Kindly help me out to get the data from 127.0.0.1 html page localStorage to http://localhost:5500(React) localStorage.

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