History.go (-1) parsing in different browsers

Source: Internet
Author: User

<a href= "#" onclick= "History.go ( -1)" > Back </a>

Click "Back" link, under Ie,firefix, History.go (-1) can play the role of back, but under Chrome does not work, with History.go (-2) to take effect.

Later, it was found that parsing in Ie,firefix to perform the onclick event, i.e. executing the history.go (-1) page, skipped the href without executing the <a> tag, but under Chrome, not only did the OnClick event, but also executed the <a> the href of the tag. Therefore, add the return false to the OnClick event to prevent the <a> tag href from triggering. That

<a href= "#" onclick= "History.go (-1); Return Fasle "> Back </a>

Or:

<a href= "javascript:void (0)" onclick= "History.go ( -1)" > Back </a>

Excerpted from http://blog.163.com/yiran_5467/blog/static/10821326201272212416782/

History.go (-1) parsing in different browsers

Related Article

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.