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

207
Visualizações
How can I fix the problem with the iframe when reloading the page in firefox?

if I enter something in the textarea and reload the page, my code is then output again in the iFrame. However, the problem only occurs in Firefox.

<div id="html-area"> </div>
<textarea id="html-editor" placeholder="HTML" oninput="changer()"></textarea>
<iframe id="viewer"></iframe>

<script>
function changer(){
var htmlcode = document.getElementById("html-editor").value;

viewfield = document.getElementById("viewer").contentWindow.document;

viewfield.open();
viewfield.write(htmlcode);
viewfield.close();
}
</script>

Can someone tell me how to work around the problem in Firefox? If there is already a similar thread, I'm sorry, couldn't find anything.

Thank you in advance for the help

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

0

firefox has the autocomplete value by default on
you should turn it off if you don't need to retrieve the data on refresh.

<textarea ... autocomplete="off">

when you use document.write to modify iframe content, an automatic entry is added to the session history for each use. so you should clean it at the beginning.

viewfield = document.getElementById("viewer").contentWindow.document;
viewfield.write('');

function changer() {
  var htmlcode = document.getElementById("html-editor").value;
  viewfield.open();
  viewfield.write(htmlcode);
  viewfield.close();
}
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