dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: iframe History Problem in Firefox

  1. #1
    Join Date
    Feb 2007
    Posts
    2

    Angry iframe History Problem in Firefox

    Background: I have an iframe with an external book wholesaler as the source. You can shop on their site and when you add a book to the shopping cart, the item is immediately sent back to my site so I can add it to the shopping cart on my site. Everything is working great...

    Problem: In order to return to the page the user was at when they add an item to the shopping cart, I have to do a history.go(-2) (for the frame contents) and a top.location.reload() to display the new cart contents. This code is in a function in the page that becomes the source of the iframe when the shopping cart is posted back to my site. The function is called via <body onload="function call">

    This is working great on most of the popular browsers except Firefox! I have tested it on IE 6 & 7, Safari, Opera, Konqueror and they all do exactly what I want. But on Firefox (versions 1.5 and 2 on Win and Mac), it works the first time, but when I try to add another item to the cart, I get the Postdata warning. It's almost as if the history changes so that it's no longer history.go(-2) when I add the second item, but I can't figure out what it should be. AND this only happens with FF.

    Does anybody have any idea how to make this work on Firefox? Sorry for the long message!

    Any help greatly appreciated...

  2. #2
    Join Date
    Jan 2005
    Posts
    3,067
    Well, it isnt always good to have things work in IE, since it is usually the wrong browser when you get errors, but if it is working in the other browsers then you have probably done things correctly. That being said, Firefox uses semantics, which means that it if you have a link object, or <a> tag, then Firefox will look for the href and go there after any other methods such as onclick() finish. To get around this you can return false, which tells the browser to stop after the other method(s), thus causing it to not look at the href. I have never had a problem with FF and history.go(), so I'm guessing that your problem is along the lines of what I mentioned above.

  3. #3
    Join Date
    Feb 2007
    Posts
    2
    konithomimo,

    Thanks for your reply. I'm actually developing in FF Mac, which makes this all the more frustrating! There's no anchors or links.

    Here's a snippet of the actual code:
    ... top of page...
    function refresh() {
    parent.frames[0].history.go(-2);
    top.window.location.reload();
    }
    ... close of script and head tags ...

    <body id="bk-message" onload="refresh();">
    ... remainder of page ...

    The way this works is that this page becomes the source of the iframe, so the code is from inside the iframe.

    I probably should have pasted the code in the first place...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles