Another advantage of using an iframe (besides cross-domain communication) is that you don't have to reset every CSS style you need. When you insert JavaScript into a page it inherits all the crazy CSS already on the page which can cause all sorts of problems. Iframes have their own context and give you an easy way to avoid that problem.
Yup. Interesting tidbit: HTML5 suggests the `seamless` attribute for elements, which would cause those CSS styles to actually affect the contents of the (and some other changes, like links affecting the location of the parent window). http://www.w3.org/TR/html5/the-iframe-element.html#the-ifram... (Of course, you meant to say “when you insert typical content DOM nodes”, not “insert Javascript”.)
How Google +1 Widgets "Break Out" of their IFRAMEs
11–15 of 15 posts
Re: How Google +1 Widgets "Break Out" of their IFRAMEs
#12Another advantage of using an iframe (besides cross-domain communication) is that you don't have to reset every CSS style you need. When you insert JavaScript into a page it inherits all the crazy CSS already on the page which can cause all sorts of problems. Iframes have their own context and give you an easy way to avoid that problem.
Re: How Google +1 Widgets "Break Out" of their IFRAMEs
#13Re: How Google +1 Widgets "Break Out" of their IFRAMEs
#14Twitter and Facebook also have script tags sitting on most websites so technically those scripts could do whatever they wanted to your page. I believe it's possible, however, to create LIKE and TWEET buttons using direct iframe tags with no need for a lib. That's the method i prefer.
Still i think all these buttons are malicious and a privacy nightmare. I 'd rather the browser vendors decided to standardize an extra sharing button, just like they effectively standardized the search field.
Re: How Google +1 Widgets "Break Out" of their IFRAMEs
#15Another advantage of using an iframe (besides cross-domain communication) is that you don't have to reset every CSS style you need. When you insert JavaScript into a page it inherits all the crazy CSS already on the page which can cause all sorts of problems. Iframes have their own context and give you an easy way to avoid that problem.
I wonder how much extra bandwidth Facebook has wasted worldwide by doing this? Twitter allows caching for 30 mins at least, good enough for back/forward caching to be useful.