Starting to think about this, too: What's better to use? an IFRAME, or a ?JavaScript-powered include? I can see elegance and hackishness in both.

shortname=oooaec

Archived Comments

  • If there is anyway you can avoid using any sort of frame, do it. Frames are evil (although I use them on my own site, but this will soon change). I am using a PHP include on some of my sites, and that works fine.
  • target="_top" is the cure for frame evilness in this case. Using PHP (or any other server-side) include is not the answer. See the earlier blog/comment as to why. I've done some more playing about with IFRAMEs and am disatisfied -- they insist on taking up a certain rectangular space, adding scroll bars if necessary. They don't resize to suit. Javascript it is then.
  • Sorry I missed you in the blogchat, Eric :) Was off eating some nummy sushi. Anyway, I've pretty much come to the conclusion that IFRAMEs are decent for making custom HTML-based UI things. I can load things up in IFRAMEs that can use javascript to influence the containing page, and the size & scrollbars are desirable. But yeah, the Javascript client-side-include seems to win as a replacement for SSI. The only thing I don't like terribly is the cramming of everything into a document.writeln(), but I can't come up with a good reason why it gives me the willies.
  • IFRAME height can be easliy managed via Javascript. Have Javascript call the IFRAME. In the script, test for browser resolution, make the HEIGHT value for the IFRAME correspond to the resolution. For ex: at 800x600, HEIGHT might equal 320, at 1024x768, HEIGHT might equal 400 and so on. In your script, you can test for res via: resHeight=(screen.height). The same can be done for width, resWidth=(screen.width). IFRAME and JAVASCRIPT are a great combo for delivering consistent content to both IE and NS users. I am in the process of redoing my entire site this way. All content will be delivered via IFRAMEs to IE & NS6 users; via JS for NS4x users. If you do it right, your IFRAME pages use the same content scripts. The real saving grace is that you keep one CSS in your IFRAME pages directory for IE users and another for NS user in you primary directory. In fact, CSS was the main reason I did this because, as you probably know, NS and IE just don't play that well together using the same CSS.
  • Actually i have had a lot of trouble properly placing an IFRAME. While it works fine on Win machines, it wont be placed right on Mac's... :( Only if i place it inline it will get placed right, but i need to move it around and all... not a good idea on a mac. (If ya need anything moving on a mac: get a hammer :))
  • Mac = toy
  • Mac = toy