-
[DHTML] iFrame SSI IV
1) CODE TITLE: iFrame SSI IV
2) AUTHOR NAME/NOTES: John Davenport Scheuer (jscheuer1)
3) DESCRIPTION: An iframe auto-resize height script. No configuration required, and it works cross browser. This is a total rewrite of the earlier versions of this script, and is coded virtually from scratch. The idea hit me the other day when I was working on importing DOM code from iframes, and as I started working on this script, everything just seemed to fall into place.
4) URL TO CODE: http://home.comcast.net/~jscheuer1/side/iframe_ssi_iv/
-
Beautiful script.
I'd use something like:
href="javascript:;" onclick="frames[0].location.replace('some2.htm')"
instead of:
href="some2.htm" target="mel"
I'm certainly going to use it.
Arie Molendijk.
-
Thanks! It will still have some of the same limitations of other resize iframe scripts. Certain types of styles and layout on either the external or top page can mess it up. But for basic pages, it is very good.
You may use whatever method you like to get pages into the iframe, including links on the pages already in the iframe. I used target, as it works without javascript enabled. I know that using javascript is preferred for validation, but the DOCTYPE's that support iframe, and those that support target aren't that different. However, if using javascript and a link to load pages into the iframe, this is better:
HTML Code:
<a href="some2.htm" onclick="frames[0].location.replace(this.href);return false;">Link Text</a>
For both accessibility (non-javascript and non-iframe folks will still see the content), and to avoid the href="javascript: . . . unpleasantness that can occur in IE.
-
Thanks a lot for this sweet script, even though i'm really pissed off because am facing a problem and i couldn't solve it yet ... when the links are hyper linked to a local page it works perfect, but when it's linked to for example another website it's causing me a problem.
Anyone knows why or how i can solve this problem please!
-
It's alright i solved the problem ...
Even though i do have one lil new problem here and i dunno what is causing it.
One of the pages that's linked to be shown in the iFrame is really long, when i open my site on IE that page works perfect, but when i open it on FireFox it adds a lil scrollbar... all the other pages working perfectly, it's only this page.
Anyone knows how can i fix that?
Best Regards!
-
First of all, directly loading a page from an external site into an iframe effectively cuts off the communication between the external and top page required by this script. Some trickery with an intervening iframe page or on the server side could probably overcome this.
If you have a page that is slightly off, you have various options, you could add a fudge factor into the script to lengthen the iframe a little, or set the style of the body of the external page to overflow-y: hidden; or perhaps simply make sure that the margin and padding on the body of the external page are 0. External pages that employ absolute and/or relative positioning can sometimes fool the script as to their actual height, so this is best avoided.
-
Thanks for the quick reply mate.
You see the idea here is that it's a phpBB forum so the pages doesn't have <body> code while it's only in one place which is "overall_header" even though i already tried to put the margin to 0 and the overflow and everything you just mentioned, but still couldn't solve it.
i mean all the other pages works perfectly fine it's only this page man i have no clue why is that.
If you want i can attach the templates to you so you can check it for me if that's possible man.
Best Regards!
-
All pages have a body, even if there is no body tag. So, style for the body will still be used by the browser. If you are using PHP though, a server-side include would be better than an iframe with javascript.
-
Thanks man, i found it and i fixed it, thanks for the help anyways man!
-
Nice script, but...
I have found a safari "issue".
My experience with the script:
FF1+ => Works perfect
IE6+ => Works perfect
Opera => Auto increase perfect but not auto decrease.
Safari => Works perfect (see below).
When pages loaded into the iframe has body style set to height:100% Safari (as the only browser) do not resize the iframe.
Thanks for a fantastic script!!