{"id":51,"date":"2008-08-22T21:01:43","date_gmt":"2008-08-23T01:01:43","guid":{"rendered":"http:\/\/hardlikesoftware.com\/weblog\/2008\/08\/22\/ie6-iframe-with-no-src-over-ssl-solution\/"},"modified":"2008-08-22T21:01:43","modified_gmt":"2008-08-23T01:01:43","slug":"ie6-iframe-with-no-src-over-ssl-solution","status":"publish","type":"post","link":"https:\/\/hardlikesoftware.com\/weblog\/2008\/08\/22\/ie6-iframe-with-no-src-over-ssl-solution\/","title":{"rendered":"IE6 iframe with no src over SSL solution"},"content":{"rendered":"<p>[This originally appeared on my dev2dev blog 9-Nov-2007]<\/p>\n<p>The WLS Admin Console is not yet using an ajax library but it does do a few asynchronous things with an iframe. The iframe had the src attribute pointing to an empty html file. I didn&#8217;t like this wasteful and pointless round trip to the server so I removed the src attribute. <\/p>\n<p>Then someone testing over SSL on IE6 rightly complained that the browser was giving a &#8220;This page contains both secure and nonsecure items&#8221; warning message.<\/p>\n<p>Turns out that IE6 has a <a href=\" http:\/\/support.microsoft.com\/kb\/261188\">problem<\/a> with iframes without the src attribute. This has been fixed in IE7. Some people recommend <a href=\"http:\/\/aspnetresources.com\/blog\/always_set_iframe_source.aspx\"> always using a src attribute<\/a> but I&#8217;m trying to squeeze every bit of performance I can out of Console.<\/p>\n<p>I thought I found the solution <a href=\" http:\/\/trac.dojotoolkit.org\/ticket\/1725\">here<\/a>. Looks like dojo solved the problem using src=&#8221;javascript:false&#8221;. This does make IE6 happy but now I get a JavaScript error in Firefox. The error I got was &#8220;Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIChannel.open]&#8221;<\/p>\n<p>I started wondering if dynamically adding the iframe would solve the problem (I still don&#8217;t know). Adding to the DOM the right way means updating the DOM as soon as it is ready. All the ajax libraries support some kind of onDOMReady event but as I said we&#8217;re not yet using a library. This got me wondering how onDOMReady works so I started searching and found Dean Edwards <a href=\"http:\/\/dean.edwards.name\/weblog\/2005\/09\/busted\/\">solution<\/a> and more <a href=\" http:\/\/dean.edwards.name\/weblog\/2006\/06\/again\/\">explanation<\/a> &#8211; a very interesting read. Something in one of the code snippets caught my eye &#8211; a script element with src=javascript:void(0). The intent is to use a deferred script element without actually loading an external file to detect when the DOM is ready in IE. This gave me the right incantation for my iframe problem.<\/p>\n<p>The final solution that makes IE6, IE7, and Firefox happy is src=&#8221;javascript:void(0)&#8221;. The void operator returns undefined which is quite different from false. This is a standard technique for the anchor href attribute so it makes sense that it would work in this context also. <\/p>\n<p>[Update 6-Feb-08 It seems a recent Microsoft security update (around Nov-07) has made the IE6 problem worse. The solution given in this article does not work after IE6 is updated. IE6, after the update, considers src=&#8221;javascript:void(0)&#8221; to be non-secure content.<\/p>\n<p>Now the only solution I know of is to dynamically add the iframe to the document with a src attribute. I&#8217;m now doing this<br \/>\nand it works fine]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[This originally appeared on my dev2dev blog 9-Nov-2007] The WLS Admin Console is not yet using an ajax library but it does do a few&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/hardlikesoftware.com\/weblog\/2008\/08\/22\/ie6-iframe-with-no-src-over-ssl-solution\/\">Continue reading<span class=\"screen-reader-text\">IE6 iframe with no src over SSL solution<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[11,3],"tags":[],"_links":{"self":[{"href":"https:\/\/hardlikesoftware.com\/weblog\/wp-json\/wp\/v2\/posts\/51"}],"collection":[{"href":"https:\/\/hardlikesoftware.com\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hardlikesoftware.com\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hardlikesoftware.com\/weblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hardlikesoftware.com\/weblog\/wp-json\/wp\/v2\/comments?post=51"}],"version-history":[{"count":0,"href":"https:\/\/hardlikesoftware.com\/weblog\/wp-json\/wp\/v2\/posts\/51\/revisions"}],"wp:attachment":[{"href":"https:\/\/hardlikesoftware.com\/weblog\/wp-json\/wp\/v2\/media?parent=51"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hardlikesoftware.com\/weblog\/wp-json\/wp\/v2\/categories?post=51"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hardlikesoftware.com\/weblog\/wp-json\/wp\/v2\/tags?post=51"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}