They're not bad practice, they're just another tool and they add flexibility.
For use as a standard page element... they're good, because they're a simple and reliable way to separate content onto several pages. Especially for user-generated content, it may be useful to "sandbox" internal pages into an iframe
so poor markup doesn't affect the main page. The downside is that if you introduce multiple layers of scrolling (one for the browser, one for the iframe
) your users will get frustrated. Like adzm said, you don't want to use an iframe
for primary navigation, but think about them as a text/markup equivalent to the way a video or another media file would be embedded.
For scripting background events, the choice is generally between a hidden iframe
and XmlHttpRequest
to load content for the current page. The difference there is that an iframe
generates a page load, so you can move back and forward in browser cache with most browsers. Notice that Google, who uses XmlHttpRequest
all over the place, also uses iframe
s in certain cases to allow a user to move back and forward in browser history.