Home > Web Front-end > JS Tutorial > body text

Solution to invalid window.location.href in IE6 browser_javascript skills

WBOY
Release: 2016-05-16 16:30:57
Original
1940 people have browsed it

The example in this article describes the solution to the invalid window.location.href in IE6 browser. Share it with everyone for your reference. The specific method is as follows:

Window.location.href is the jump function in js. Many people will find that window.location.href cannot jump in IE6. Let me introduce the reasons and solutions to you.

The problem code is as follows:

Copy code The code is as follows:
Click to jump
<script> <br> test = function(){ <br> window.location.href = "http://www.jb51.net"; <br> } <br> </script>


The correct code is as follows:
Copy code The code is as follows:
Click to jump
<script> <br> test = function(){ <br> window.location.href = "http://www.jb51.net"; <br> } <br> </script>


Reason:
Return false so that the browser's events will not continue to bubble out and trigger the browser's default event

Summary
The principle is not that window.location.href is incompatible, but that our return false later prevents the jump.

I hope this article will be helpful to everyone’s JavaScript programming design.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template