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
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();
}