IE (6-11) version, when using the framework of the IFRAME, via a tag javascript:; And JS Jump parent.location when it appears on the new page open case

Source: Internet
Author: User

Problem Description:

In the case of an IFRAME, in a child frame, use the following form of jump:

<href= "javascript:;"   onclick= "parent.location.href= ' login.php ';" > exit </a>

In IE browser, click, will be in the case of exit, and then open a page, the URL is displayed as javascript:; , that is to say, a tag of javascript:; Not effective!

This is a strange phenomenon, and there is no such problem in modern browsers such as Google. The last guess is that the href attribute of a tag is parsed under IE by passing the value of the href to the parent frame, then a jump to the value of the href in the parent frame, and the value of the href is already a string and does not have the function of executing JS. Therefore the error is opened directly in a new window with the URL javascipt:; The solution to this problem is to block the default event for the a tag before passing it, as follows:

<href= "#"  onclick= "parent.location.href= ' login.php '; return false ;" > exit </a>//or use jquery, the Event.preventdefault () method can also achieve the same effect. 

Record for backup

IE (6-11) version, when using the framework of the IFRAME, via a tag javascript:; And JS Jump parent.location when it appears on the new page open case

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.