User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.0 Build Identifier: Firefox 5.0 top.window.frames['frame_name']history.length returns combined history of parent and an IFrame. If you have an iframe in the document, and want to see the length of its history (iframe inly), it returns the wrong info which is actually a sum of history in parent window and an IFrame. IE8 behaves correctly in this situation. Reproducible: Always Steps to Reproduce: 1. Create an IFrame in the main window 2. alert(top.window.frames['frame_name']history.length); 3. click on a link in the IFrame, and check alert 4. click on a link in the main window, and check alert Actual Results: 1. - 2. - 3. - 1 4. - 2 Expected Results: 1. - 2. - 3. - 1 4. - 1 Hope it is clear, if you need any extra info email me.
Summary: top.window.frames['frame_name']history.length returns combined history of parent and an IFrame → top.window.frames['frame_name'].history.length returns combined history of parent and an IFrame
OS: Windows 7 → All
Hardware: x86_64 → All
Version: unspecified → Trunk
Created attachment 541646 [details] [diff] [review] Testcase I'm not sure if this test case correspond to your description. Does it?
Well, this is exactly how browser behaves. Returns combined history.length
Comment on attachment 541646 [details] [diff] [review] Testcase ><!DOCTYPE html> ><html> > <body> > <iframe name='f' src="<a href='data:text/html,<p>Hi there, Im an iframe</p>'>Iframe link</a>"></iframe> > <button onclick="alert(top.window.frames['f'].history.length);">show history count</button></ br> <a href='data:text/html,<p>Hi there, Im a main window</p>'>link</a> > </body> ></html>
Now if you click on the link in the main window, history count will still increase.
There is only one history involved. All the frames are flattened into a single history list. The HTML5 spec says, at http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#the-history-interface : window.history.length Returns the number of entries in the joint session history. and http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#joint-session-history defines: The joint session history of a History object is the union of all the session histories of all browsing contexts of all the fully active Document objects that share the History object's top-level browsing context, with all the entries that are current entries in their respective session histories removed except for the current entry of the joint session history. which is exactly what we're doing.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.