Read the statement by Michael Teeuw here.
Html into Iframe
-
Hello, I try to put my own html code into an iframe but it doesn’t work. How shoudl I that ?
I tryed :getDom: function() { var wrapper = document.createElement("div"); var iframe = document.createElement("iframe") iframe.src = this.file("biblop.html") wrapper.appendChild(iframe) return wrapper }No error, (I can see the border of the iframe) yet nothing happen in it
I tryed to “write” the html into the iframe as well, thinking that I could use the node helper to read my html file to get the content eventually.
getDom: function() { var wrapper = document.createElement("div"); var iframe = document.createElement("iframe") var myContent = '' + 'My dynamic document' + '<p>Hello world</p>'; iframe.contentWindow.document.open('text/htmlreplace'); iframe.contentWindow.document.write(myContent); iframe.contentWindow.document.close(); wrapper.appendChild(iframe) return wrapper }But content.Window is null every time so it can’t be open.
I tryed to tweak those two solution in different ways (like using absolute path) but the end result was the same.
How can I do that ?(PS: I tryed the first code I wrote above outside of the magic mirror first on my ubuntu and it was working just fine. Soemhow it’s the magic mirror itself that don’t like it)
-
Scratch that, the first example is working. It’s just that, because of the body black background, the text inside the iframe wasn’t visible. Justed needed to to change the css for the iframe to overide the background of the body
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login