iframes

In regards to iframes: Why would they be a good thing and why would they be bad? I’d just like to get a general feel for what your opinions on them may be.

Well,

There is really no “correct” answer to your question. It is true that iframes are not as widely supported by different web browsers, and are more likely to be displayed differently in different browsers, this being the reason why some hate them with passion. Yet, if you test your site is a few major browsers and they appear to display fine, then I see no problem.

When used correctly, an iframe can add an extreme amount of functionality to a website that would be hard to achieve through other means. That being said, often I see iframes abused. Personally, I rarely use iframes, however a few weeks ago I was working on a project, and using iframes made the site much more fluid and user friendly. I’m sorry but I really don’t have an example of a good looking iframe vs a bad one.

In the end, it all comes down to what you think looks best. Try a site with them, then without and see what the pros and cons of each are.

Lastly, I should mention that often search engines do not handle frames well at all, and therefore if it is important that the content inside the iframe is spidered, that factor may influence your decision against them.

Sorry I’ve rambled a lot, but I hope this helps you somewhat.

Jack

Heh.

The Robocard’s web page uses IFrames. Easy to use and very easy to navigate around with it…

http://www.robocards.org

I like I-Frames - but older browsers don’t like them and if I rember correctly they are not W3C compliant (something of that such)

See, the thing is, what functionality does that iframe add to that page? What would be worse about just putting the contents of that iframe inline in its own div or something? iframes do allow you to switch pages without reloading the entire page, but they also are kind of messy and interfere when I scroll with a mousewheel. I think that they’re ok if used correctly, but for the most part I would try to do as much inline as possible.

That’s the one downfall.

When this page was implemented it was at a fixed pixel. No resizing, no nothing.

If you mess with it you can get it to where everything tries to stay inside the main window it’ll all work - but i will admit you are pretty much stuck with the size.

It was planned for people with larger resolutions running IE…:o

I’m 1024x768 in Firefox.

The iframe displays wayy down at the bottom, not next to the links where I think it should.

Why not keep it at fixed width then? There’s no need to make a page resize to the user’s browser, plenty of sites don’t. Look at yahoo.com or google.

The main thing I’ve found iframes good for is if your server doesn’t support server side includes, or if you want to continuously refresh an included page.

For example, on my website, I had a little #include that showed a live stock price. But, it’s written directly into the DOM tree, so you can’t refresh the #include without refreshing the entire page. Using an iframe can allow you to get around that. The only problem is that you have to make sure you’re going to be ok at all resolutions (as was mentioned earlier).

MrToast

That’s a really good example of why everyone hates iframes. Jesus.

Let me add in some commentary that should clear a bit of this up and lay to rest a few fallacious notions that I see about frames every once in a while.

To which browser are you referring, specifically? In all fully-functional browsers I’ve used, iframes are “supported.” They are displayed slightly differently across the board, like anything else (and behave strangely and improperly when viewed with the Usual Suspect), but all browsers worth worrying about will do them just fine for everyday tasks. For this reason, I find it hard to condemn frames because they look different in different browsers. I mean… text sizes look different from IE to Mozilla to Safari. Should we not use text?

Let me just add to this to say this iframe “look” thing is totally subjective, and is also a silly reason to preach not to use them. I can, and have made an iframe look completely seamless. As Jack pointed out, iframes and frames can do unique things from both visual and structural standpoints that can turn out to be very useful. Those of you who suggest the use of includes instead of frames as some all-encompassing solution miss the point of their existence entirely (although in some specific cases includes are perfect for the job).

Case: the Webmaster has some CGI forum software he wants to integrate into the look of his site. He is either unable or unwilling to delve into the source code to include the forum contents between a header and a footer. Instead, he takes the final output (i.e. website.com/forum/index.cgi, a nice, clean, generated text/html page) and slaps it in an iframe placed within his site layout template. An important advantage to this approach (as Greg Marra sort of pointed out) is that the layout no longer needs to be loaded as someone clicks through links in the forum. Problem solved. Time elapsed: like… five minutes.

An aside: if you want to have a static menu and a scrolling content area, do yourself a favour and use includes with CSS to simulate the visual effect. It is this specific usage that makes people hate frames with a passion.

This is absolutely true, but good semantic coding can defeat the majority of these problems, at least with Google. If user-agents and consumers can tell that something is part of a bigger picture, the problem is not so big anymore. For example, while this does not solve search engine spidering problems (use meta tags for that!), one can use Javascript to determine if a page is enclosed in a frame or not, and then based on that detection, load the frameset as it is meant to be seen.

I’m sure you mean by that statement that the iframe element is not part of the HTML specification put out by the W3C. This is incorrect.

Element dimensions can be defined as percentages of the browser window size (or the enclosing box element’s size), which the browser can calculate in real time as you resize the window. And of course you don’t need me to tell you how infuriating it is to still be seeing suggested resolutions and browsers at this day in age. Judging by the smilie, I think Matt is well aware of that.

Don’t blaspheme. Or diss other peoples’ work for that matter. Well, you can do either, but I doubt either will make you any new friends here. More importantly though, the theory behind that implementation is likely similar to that of the aformentioned case study. While visually it might not always work, saying “frames suck” because of that is hardly reasonable.

:sigh: I hate that…

I Surf at 1024 * 768 in IE btw.

Huge gaps on the sides of a lot of webpages… It’s really annoying.

CD stretches and fits my whole page. I like that!

I’m not saying that frames suck because of that site, which you really can’t deny is ugly and broken. I’m saying that poorly used iframes make people hate all iframes, even ones that are used properly.

I’ve only ever come across two sites that use frames in a correct and appealing manner. They are http://www.realgurus.com and http://www.apple-history.com

Personally, I can’t stand frames. They seem to be a lazy way of coding a page, and they rarely turn out correct.

MrToast

Those could have been done without frames. I thought frames were pretty neat back when I thought Netscape 3.0 was pretty neat. Right now Google Images is the only good example of frame use I can think of.

Thanks for all the opinions guys. I’m actually doing a project for the Western Michigan Art School. My boss suggested mocking up an iframe layout that would allow us to keep the navigation bars without using a server side include, to speed things up and whatever. I think I’m going to advise we stick to how things are now (except I’m in the middle of a CSS rewrite of the nav bar to get rid of those javascript rollover images). Thanks again for all the advise.

There’s a problem with viewing the site in FireFox. I’m currently trying to figure out what is causing the problem.

Back on topic though, I find that iFrames can be either good or bad, but not inbetween. I don’t like using them, but there are sites out there that do use them correctly. One site that I personally think does it well is http://www.xjapan.de/main.htm. Another that does it poorly is a few I’ve made (which is long gone by now).

There are two reasons why that site uses iFrames correctly:

  1. The menu on the left doesn’t extend beyond the bottom of the page (at least not in my browser)
  2. The frames don’t have those wicked annoying borders. Borders = bad. They disrupt the flow of the page.

MrToast

http://www.davedelong.com/daveware <<— can you find the iframe? :smiley:

If your webserver allows SSI includes or supports PHP (and thus PHP includes) I highly recommend using them. I have done several websites with includes (http://www.southwindsorswimclub.com for one), and found them very useful in quickly editing content while providing a nice enclosing feel to the site. A header.html and a footer.html are easily included and open and close my content area, so each page only need to be the content that actually goes in that page. It makes things much easier to track and edit, IMHO.

Two ideas. Try adding style=“float: right” to the iframe tag, or extend the table that does your navbar with another td with rowspan=8 and that way it will -always- be inline with the navbar. Just make sure to set heights and widths appropriately. Oh, also you might be using percents for widths, and the percents could round off in such a way in FF that the iframe is just too big to fit next to the navbar, and so its inserting a linebreak to get it down. Try reducing it’s width slightly too.

Can YOU find the iframe? http://www.team188.com/web/index.php?page=forum&pagetitle=Forum

That’s not an iframe per se. But nice CSS in that page.

Yeah, a certain property of the iframe element doesn’t allow me to do what I wanted to do (basically make it seamless, by enclosing it in a smaller box), so I made the “iframe” an object (type=“text/html”) to get around that while maintaining complete validity and semantic soundness; this trick works in all browsers I’ve tested, as it should if you read the XHTML and HTML 4.0 specs… but I was hoping you guys wouldn’t figure it out so fast.