Iframe facts

Key takeaways from Chapter 13: Using Iframes Sparingly of "Even Faster Websites", a guide for performance vigilantes -
  • Relative URLs inside the iframe are resolved relative to the iframe’s base URI, not the parent’s.
  • JavaScript included in the iframe has limited access to the parent. 
  • An iframe from a different domain can’t access the parent’s cookies.
  • Iframes are one to two orders of magnitude more expensive to create than other types of DOM elements.
  • An alternative way to insert ads with better performance would be for the main page to create a DIV to hold the contents of the ad. 
  • We want the onload event to fire as quickly as possible. Iframes block Onload.
  • A workaround to blocking behavior in Safari and Chrome is to set the iframe’s URL dynamically with JavaScript instead of setting it with the HTML SRC attribute.
  • Resources in an iframe are downloaded in parallel with resources in the main page. 
  • Using an iframe does not increase the number of parallel downloads for a given hostname.
  • The connection pool is shared across tabs and windows for all these browsers.
HTML5 has some new attributes, and some HTML 4.01 attributes are not supported in HTML5. 

TODO: Update SearchLite v2, my 2002 script that uses IFrames & give it a makeover


Comments