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!
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.