Closed Bug 787381 Opened 13 years ago Closed 13 years ago

Javascript loads HTML, Firefox counts this as a new page and puts in History

Categories

(Core :: DOM: Navigation, defect)

10 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 321084

People

(Reporter: nicholas.burkard, Unassigned)

References

()

Details

User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10 Build ID: 20100914125854 Steps to reproduce: I call a third party script (AddThis) at the onload event which in turn loads other scripts, css, images, and even an html page. Note the bug is for all versions of Firefox that I have seen (3.5, 8, 10, 14) Actual results: Even though the current page xyz.com remains visible, by the javascript calling an html asset, Firefox thinks this is a new html page has been browsed to and gets added to the history buffer. Therefore when I click Back nothing visible happens (takes me back to the page I am already on, according to the address bar). I need to press Back twice to get back to the expected previous page. Note, the problem does not happen if the third party script is loaded to the page before the onload event. Only happens when I load the script after the onload. Expected results: All other browsers handle the situation as expected. I hit my page xyz.com, the 3rd party script runs at onload and it calls an html asset but when I hit Back I go to the previous page.
The Forward button actually has a similar problem. I have two sample URLs. Start on the following page, click the link to page 2 and then hit Back and you will not go back until you hit it a second time. http://qawww.thehartford.com/cs/ContentServer?pagename=SandBox/Nicholas/add-this-1
Is the script basically doing a load in a subframe?
Component: General → Document Navigation
The script is from a 3rd party (AddThis), so I am not positive how it works. But I think you are correct. In fact, the HTML page that is loaded has a Title = AddThis Utility Frame. I see an iframe being added to the <head> which has this Title.
OK, thanks. This is happening because we allow navigating back in iframes. Other UAs do this too, but some of them don't allow navigating back to the initial about:blank. Pretty sure there are existing discussions about that...
Whiteboard: DUPEME
Not sure I completely follow. I have not navigated to anything in the iframe, just added it to the dom. So if you add an iframe after the page is loaded, it counts as a navigation to the page, whereas if you load the iframe as part of the parent page load it does not? This is just the way it goes...and you're saying this is not a bug then? I have searched on this and have come up with little help/explanation. If you have a link to a discussion/workaround on this, I would appreciate it.
The iframe isn't getting navigated as part of loading the "HTML asset"?
The iframe is not visible. I has nothing in it but script. The script must be doing something to cause Firefox to think it has navigated. I did a test...if there is no script in that iframe then the back button works. As I said, this is not my script and I don't have the time to try to figure it out. Any more comments are welcome...otherwise it looks like this is not a bug, at least I don't have the means to pursue this further since I don't know the script. Thanks for looking into this.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
Whiteboard: DUPEME
You need to log in before you can comment on or make changes to this bug.