Forum Moderators: open

Message Too Old, No Replies

Frames, iFrames and Objects

Which is better?

         

daosmith

12:14 pm on Jun 26, 2003 (gmt 0)

10+ Year Member



Recently I read an article on CSS2 that stated that frames could be replaced with an <object> tag and fixed positioning - has anyone seen/utilised this? And if so, is this preferable to using frames or iframes?

I'm currently using frames and javascript to avoid orphan child pages but was considering moving to iframes until I read about the <object> possibility - but I've never seen an object tag reference an external HTML file... any further information would be greatly appreciated :)

tedster

5:59 am on Jun 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld -- an interesting question you bring up.

I've never used <object> in this way, but I it should be fine - <object> can also replace the <img> tag. However, I'm not sure I see any advantage. Any of those three approaches -- frames, iframe, or object -- will always give the risk of search engines sending visitors straight to the external file. There's no way around that.

Here's the basics on the object element ---

ELEMENT
<object classid="URL" codebase="URL" data="URL" id="name" type="mime-type">

ATTRIBUTES
1. classid: URL of the program needed to implement the object's content.
This is equivalent to the code attribute in the deprecated <applet> element.

2. codebase: the URL of any plug-in needed

3. data: URL of the actual object, similar to the older src attribute

4. id: a unique name that can then be defined in CSS or used by JavaScript to access the object

5. type: The mime-type of the object, e.g. text/html

So fire up your browser, write a couple test pages, and let us know what you discover.

daosmith

12:50 pm on Jun 27, 2003 (gmt 0)

10+ Year Member



Thanks for the info tedster... I assume that for external html links the classid and codebase attributes should be empty - I'll give it a shot and see how things go.

daosmith

1:30 pm on Jun 27, 2003 (gmt 0)

10+ Year Member



No luck, unfortunately - Mozilla/Netscape correctly displays the external HTML, but both IE (spectacularly) and Opera (to a lesser extent) display the file improperly - there is nothing wrong with the <OBJECT> display per se, but I can't seem to emulate the 'scrolling=no' <FRAME> attribute... 'overflow: hidden' just doesn't seem to apply for either Opera or IE.

I guess I'll stick with iFrames after all. Thanks anyway, tedster.

mossimo

10:13 pm on Jun 27, 2003 (gmt 0)

10+ Year Member



Hay daosmith

a little off topic but have you ever expericanced iFrames not fully displing in IE on page load, needing to refresh to disply iframe?

daosmith

2:56 am on Jun 28, 2003 (gmt 0)

10+ Year Member



Hi mossimo - my experience with iFrames is pretty limited; I'm just in the process of switching all my files around so that they use iFrames instead of regular frames for the first time... but so far they have been displaying fine. I'm sorry I can't be of more help :(

ShawnR

11:25 am on Jun 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi daosmith

As Tedster said, iframes don't solve the problem of orphaned pages, and have more disadvantages than regular frames when it comes to browser comatibility (although admittedly all the modern browsers have no problem with either frames or iframes. So I am wondering what you want to achieve? Why are you "switching all [your] files around so that they use iFrames instead of regular frames". It is a bit of a step backwards.

Frames have pros and cons. If, for you, the cons outweigh the pros (as they do for many, especially those who hang around WebmasterWorld) then you can get rid of them by flattening your page, using css, etc (look in the css forum's library). But using iframes or objects won't help.

Shawn

daosmith

1:21 pm on Jun 28, 2003 (gmt 0)

10+ Year Member



Hi shawn - the advantage, in my case, of iframes is that I can then do away with the javascript to cope with orphan pages - the iframe will hold the navigation page, which has instructions in robots.txt not to be indexed, and a meta tag telling robots to NOINDEX,FOLLOW. Each page will be a frameset in itself, so to speak, and as the navigation page will never be indexed, it will not become an orphan page in search engines...

Then I can scrap the javascript, which firstly simplifies the page, and secondly, allows people who have javascript turned off (grr) to see the website! I don't see how an iframe is technically any better or worse than a regular frame, but for my purposes I think it is the better choice.

However, if I could emulate the frame using css (without huge redundancy) that would be even better - any particular threads in the css forum I should take a look at?

ShawnR

1:41 pm on Jun 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK, now I understand that the iframe won't be indexed, I see the advantage.

"... don't see how an iframe is technically any better or worse than a regular frame...
Not supported by Netscape 4. Of course, since that is such an old and crappy browser, that may not concern you.

"...any particular threads in the css forum I should take a look at..."
Well, there may be redundancy, so it depends on what you are prepared to tolerate. You could have a look here:
[webmasterworld.com...]

or other threads here:

[webmasterworld.com...]

But if you are just using the iframe to prevent redundancy, not to have some part of your site static while the rest can scroll, you could use SSI or php includes.

Shawn

daosmith

3:02 pm on Jun 28, 2003 (gmt 0)

10+ Year Member



Thanks Shawn, I'll take a look at the links you mention - I am using the frame (also) for static content, and hence ssi/php includes aren't really an option - especially so given that I'm not sure my client's host supports ssi, and that php support incurs an additional cost.