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

103
Visualizações
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 à 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