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

177
Visualizações
The embedded widget script unable to generate its html inside React env

I wanted to load a survey widget in the react project, where I create and execute the script in the head after dom gets loaded. But it is unable to generate its poll HTML.

Here is react demo in codesandbox

If I load the same script inside the specific element in the body without react env it works, here it's demo in jsbin

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <h1>Polldaddy Title</h1>
 <div id="pollDaddyInfo"> 
   <p>Poll should generate below this statememt</p>
   <script charset="utf-8" src="https://static.polldaddy.com/p/10962229.js"></script>
 </div>
  <h1>Polldaddy End</h1>
</body>
</html>

Help me to identify what could possibly go wrong?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

There is nothing wrong with your implementation in either scenario (i.e. with and without react environment).

Actually, in react environment you're loading the script which is async operation and an script that is loaded asynchronously cannot write on the document with document.write which is happening here

https://docs.google.com/document/d/1v3qxRRU7aPs7rk_RwsDPDwuE22Yi1KG_oyKmmgD3lGY/edit?usp=sharing

For supporting my argument here is another thread on stack overflow

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