SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    IFrame History problem

    Hi there.

    I have an IFrame within a frame on my page.

    On the page that contains the IFrame itself there are a series of buttons that send the IFrame to different sites (Not on the same domain etc)

    These buttons work fine as do two more which are used like the Back and Forward buttons on a normal toolbar, however, they don't work in Firefox etc.

    At the moment I'm using:
    history.back(); and history.forward();
    and in IE this works fine, going through the IFrame history as intended. However, in Firefox it accesses the history of the top page rather than the IFrame.

    Can anyone help here please? I'm trying to get this site together so that its compatible with at least IE and Firefox, but this bit is really causing me a headache!

    Thanks

    Max

  2. #2
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't use frames. Use SSI or PHP includes instead.

    Why Frames Are Bad
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  3. #3
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes. I'm sure thats all very helpful (I didn't read it)

    However, I am on a simple ISP account without PHP or SSI and I use IFrames. That is why I asked a question about IFrames.

    If you don't know the answer then thats fine! Neither do I, that why I'm asking, but please, if you don't know, don't just post about other things. I don't care why IFrames are bad, I just want an answer to a scripting problem.

    Now then, does anyone here know the answer to my problem?

    Max

  4. #4
    SitePoint Guru
    Join Date
    Feb 2005
    Posts
    602
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:

    oIframe.contentWindow.history.back()

    where oIframe is the iframe element. Or:

    frames.iframeName.history.back()

    where iframeName is the name of the iframe.

    EDIT: changed iframeName to frames.iframeName
    Last edited by Maian; Apr 3, 2005 at 01:56.

  5. #5
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does your host support ASP?

    This is one of the many reasons that frames and iframes are bad.

    You could try specifying that you want the history of the iframe instead of the top window.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  6. #6
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maian: I'm afraid Iv tried both of those and neither of them work.
    In IE a simple history.Back() will work because it works for the current frame rather than the top window, but it doesnt work in Firefox etc as well, which is the main problem.

    Kravvitz: Nope! My ISP account is HTML only, which is why I'm using JavaScript to do these things. Do YOU know how to specify that I want the history of the IFrame instead of the top window using just JavaScript?


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
  •