Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: [DHTML] iFrame SSI IV

  1. #1
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,475
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default [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/
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  2. #2
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,875
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    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.

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,475
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Feb 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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!

  5. #5
    Join Date
    Feb 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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!

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,475
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Feb 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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!

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,475
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. #9
    Join Date
    Feb 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks man, i found it and i fixed it, thanks for the help anyways man!

  10. #10
    Join Date
    Apr 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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!!
    Last edited by sylteflesk; 04-13-2008 at 09:57 AM. Reason: Update needed

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •