views:

607

answers:

4

i have a webpage with an iframe pointing to another website. I dont want this to block the loading of the rest of the page. is there a way to load it asyncrounously?

+1  A: 

iframes should load asynchronously without any effort on your part.

outis
+1  A: 

It shouldn't block. If you want the main page to fully load first (eg, main page's images before iframe content) then you'll have to use a bit of javascript to set the url of the iframe, like <body onload="javascript:...">

Steve Cooper
+1  A: 
Joel Alejandro
A: 

One problem we had was that while iframes already do load asynchronously, the main page will not fire OnLoad until the iframe has finished loading too.

We worked around this by 'faking' OnLoad by calling the method we wanted in a script element at the bottom of the main page, even outside the closing body tag:

</body>
<script  type='text/jscript' language='javascript'>
BodyOnready();
</script>
Coxy