A pit that has been trampled--browser compatible-history

Source: Internet
Author: User

1. History

1.1. Page layout:

A typical Kaminaka (left/right) layout. The main use is frameset and frame.

1 <frameset name= "Total" col= "10%,80%,10%" > 2  3 <frame name= "Top" src= "top.html"/> 4  5 <frameset Name= "Content"  > 6  7 <frame name= "left" src= "left.html"/> 8  9 <frame name= "right" src= " Right.html "/>10 </frameset>12 </frameset>

1.2, the performance of the pit (ie browser):

Click the left column option in IE and the content page on the right changes accordingly. Clicking the hyperlink in the content changes the content's SRC, which returns to the interface of the previous content (ie browser) via History.back ().

Operation Flow:

Click Option 1 on the left column to change the content to C1 page. Then click on option 2 to correspond to the C2 page.

At this point in the C2 to place the hyperlink, change Name= "right" of the frame page content, C2 changed to C3. But click on the browser's return arrow--> the C1 interface is returned instead of C2. Similarly, a return button is placed on the C3 interface. button to add the Click event: History.back (). When you click the Back button, you will also be returned to the wrong C1 interface.

1.3, the speculation of the pit

History different browsers have different ways of determining their records.

I guess IE does not record the way the frame content is changed by hyperlinks in this frame, which is equivalent to a record that the history does not currently have a C2 jump to C3 and is currently in C2 state. Thus led to the history.back when jumping to the C1.

Finding data: http://benalman.com/code/projects/jquery-hashchange/examples/bug-webkit-hash-iframe/This is an example, is also the ie89 under the history of the problem caused by the abnormal. HTTPS://GITHUB.COM/COWBOY/JQUERY-HASHCHANGE/ISSUES/17 this has the same problem, but temporarily did not find a solution.

The real reason: http://msdn.microsoft.com/en-us/library/cc288209%28v=vs.85%29.aspx. In IFRAMEs or frame, no modification of location.hash is triggered. So it's not recorded in the history (bingo, guessed right ~ ~ ~).

Follow-up Perfection ~ ~

A pit that has been trampled--browser compatible-history

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.