I keep seeing people talking about different ways to access the document of an iframe. This method(after much hairpulling and testing) works very well.
$('iframeID').contents() The .contents() method will automatically handle the browser differences between contentWindow and contentDocument. It will give you standard access to the iframe document no matter what browser. Further, if there are particular non-jQuery things you want to do in an iframe, its still a great way to do it. So for example, a problem I have been working on for several weeks involves adding a script into the iframe which itself calls another script for our forum system(Jive) that displays a list of comments. As a sidenote, the commenting system in Jive absolutely SUCKS. No caching, does document.writes, etc. The forum bit is really nice, but the comment system needs to be shot. So I am loading an iframe into the dom, then writing the script that loads the Jive comments into the iframe. When I was using the strict jQuery methods: $('#commentiframe').contents().find('body').html(scriptvar) It would write into the iframe, but it conflicted with some of the ads we serve on our site. Jive's comment widget does a bunch of document.write's into the document, and using the standard jQuery method the comments were being added to the page at the first occurrence of a script tag. Very, very wierd. So, the way I found around that was to drop back into normal javascript methods and came up with this: $('<iframe id="commentiframe" src="'+scriptvar+'"></ iframe>').appendTo('body'); f=$('#commentiframe').contents()[0]; f.open(); f.write(scriptvar); f.close();