Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

13. Using Iframes Sparingly > Summarizing the Cost of Iframes

Summarizing the Cost of Iframes

Even blank iframes are expensive. They are one to two orders of magnitude more expensive than other DOM elements.

When used in the typical way (<iframe src="url"></iframe>), iframes block the onload event. This prolongs the browser’s busy indicators, resulting in a page that is perceived to be slower. Setting the iframe’s SRC dynamically avoids this problem in Safari and Chrome. For other browsers, setting the SRC after the onload event avoids the problem.

Although iframes don’t directly block resource downloads in the main page, there are ways that the main page can block the iframe’s downloads. In addition to the expected behavior of scripts, stylesheet downloads in the main page block the iframe’s downloads in both Internet Explorer and Firefox.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint