Why do some websites (like facebook) load scripts in an iframe?
html, iframe, javascript
Solution
What you are seing, might be an application of "Comet" communication, using a hidden iframe as data channel. A short explanation of the technique according to Wikipedia:
A basic technique for dynamic web application is to use a hidden IFrame HTML element (an inline frame, which allows a website to embed one HTML document inside another). This invisible IFrame is sent as a chunked block, which implicitly declares it as infinitely long (sometimes called “forever frame”). As events occur, the iframe is gradually filled with script tags, containing JavaScript to be executed in the browser. Because browsers render HTML pages incrementally, each script tag is executed as it is received.
This could be used for something like a chat, where messages are expected to appear without noticeable delay, and preferably without periodical "polling" for new data. If this is what you have come across, you should see several `<script>` elements in the frame, and more should be added as times go by.
Problem
Why do some websites (like facebook) load scripts in an iframe? Is this to allow the site to load more than 2 resources at a time because the iframe's resources are at different URLs?