IFRAME vs JavaScript-include - FIGHT!
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
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
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.
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.
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.
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 :))