Having following code <iframe id="myframe" src="..."></iframe> <script> document.getElementById('myframe').onload = function() { alert('myframe is loaded'); }; </script> i wonder how does the browser processes an iframes? Does it load the iframe content in the separate thread? If so is it run synchronously with the main thread?
Older browsers definitely use 1 thread. Most current browsers use 1 process. Chrome does additional tabs & iframes out of process.
So in the case of "current browsers" does it mean that when the browser hits <iframe> tag it starts a new thread to process & load iframe content while the main thread continues processing the main site code - that is it processes the JavaScript code lying below the iframe tag?
Only in Chrome and what Chrome actually does is questionable. Most browsers will run 1 thread. For coding a site you should just expect the browser to run 1 thread total.
Ok so what is the processing sequence? That one main thread first finishes processing the main site code ended with </html> tag and then starts to load & process the iframe content?
It depends on the browser and you'd have to really study browser internals to find out. I doubt that information is available.
Try Mozilla Developer Network. If not on the page I linked, there are others aimed at Firefox developers, too. gary //edit: For practical purposes, loading an iframe is equivalent to loading an image or object. ~g
Which is part of why we were told with 4 Strict that in the next "real" HTML IFRAME and IMG would be deprecated in favor of OBJECT. This never materialized though as too few people embraced the improvements of Strict (even fewer grasped the concepts), and then the WhatWG came along and pissed on any real improvements inside <body> with their "HTML 5".
Make sure search robots can access the content in your iFrame. You can do this easily by indexing the iFrame with robots.txt.