WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 appending <link> to an iframe, Josť Jeria, April 26, 2004
     Re:appending <link> to an iframe, Josť Jeria, April 27, 2004
         Re:appending <link> to an iframe, aa, October 5, 2004
         Re:appending <link> to an iframe, Erik Arvidsson, May 1, 2004
             Re:appending <link> to an iframe, Josť Jeria, May 2, 2004

Subject: Re:appending <link> to an iframe From: aa Date: October 5, 2004
This has now been solved by changing
var elm = document.createElement("link");
to
var elm = content.contentWindow.document.createElement("link");
But now I have another different problem. When the iframe gets the designMode set to on, the css applied goes away, and you again see the white background with the default font. It doesnt help to add the designmode after I added the <link> tag...

/Josť Jeria
From: Josť Jeria
Sent: April 27, 2004
Subject: Re:appending <link> to an iframe

Following works fine in Mozilla but not in IE, how can i append the <link> tag in IE to the iframe?

Also I noticed that this doenst work if no src is set. test.html is just a empty html page.

<script type="text/javascript">
window.onload = function()
{
var content = document.getElementById("content");

content.contentWindow.document.designMode = "on";
content.contentWindow.focus();

var elm = document.createElement("link");
elm.rel = "stylesheet";
elm.type = "text/css";
elm.href = "css/iframe.css";

content.contentWindow.document.getElementsByTagName("head")[0].appendChild(elm);
}
</script>

<iframe id="content" src="a.html" frameborder="1"></iframe>





Reply
Name: 
Email: 
Subject: 

Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.


View All Messages
Back to WebFX