Last post Jan 05, 2017 12:49 PM by Translating-it
Jan 04, 2017 08:08 PM|Translating-it|LINK
I finally managed to get contenteditable to work on an iFrame in Firefox but only if it is populated manually via a function, if I try to run the function automatically when loading the page, the test string appears for about a few miliseconds in the iFrame
but then it is set to empty immediately and I don't know why. In IE it works fine.
var iframeBody = $("#test").contents().find("body");
var styleTag = iframeBody.append('<div><b>hi</b></div>');
<p><iframe id="test" style="width:540px; max-width:540px; max-height:200px; resize:none" designmode="on" contenteditable="true"></iframe></p>
first I would like to be able to set the text on pageload or similar.
Thanks for your help in pointing out what I missed. ;)
Jan 04, 2017 08:33 PM|Translating-it|LINK
Ok, just found out that this has to do with the iFrame being empty.
How can that be?
Jan 05, 2017 12:49 PM|Translating-it|LINK
I found a working solution:
var doc = document.getElementById('test').contentWindow.document;
doc.write('<head><link href="https://www.translating-it.eu/spellcheck.css" type="text/css" rel="stylesheet" /></head>');
I even can change tag and everything with this.