IE6 the request under Link onclick event processing is aborted

Source: Internet
Author: User

IE6 under the problem is really many, these two consecutive days encountered several, including IE6 tr can not add border border style, all the other OK. Today again encountered form form inside with a link simulation form submission event, found in JS implementation of the form of the submit event, backstage also received the event, and IE6 under the HttpWatch after debugging found that processing request aborted before response Message is received. Other browsers include Chrome,ff,ie7 or above, and 360 is no problem with the high version.


Originally in the form form inside the a link written as

<form id= ' applyform ' >
<div class= "Submit-back" >
<a class= "Sub-button" href= "Javascript:void" (0); " ></a>
</div>
</form>

Js

     $ ('. Submit-back '). Click (function () {
         //... Form validation
         $ (' #applyForm '). Submit ();
      

Then click a link and the case above appears.

After looking up some information on the Internet, the problem under IE6

The (aborted) value is more complex into its origin. It occurs when IE has started to process the request for a URL (e.g. to download an image), but then and decides to cancel the Operation. Here are some examples of the When this can be occur:if you click on a link or bookmark while a page are downloading, or click on IE ' s Stop button, you'll be cancels any requests which are still active and HttpWatch shows the (aborted) ResU jth A CSS rollover image on a page would start a request when the mouse pointer was moved into its active area. If the mouse pointer quickly moves away again, IE may abort the request if it has not already. Sometimes JavaScript is used to fire out requests for background tasks or to gather on a page. Often this can leads to aborted results if the JavaScript does does not wait for the response of to is received from the server. Continue to find the source, search to find this problem is a IE6 in the underlying mechanism of the bug, after the version has been resolved. It is said that <a href= "javascript:void (0)" > or <a href=# "> Such use of a label will not prevent the end of a tag to trigger a behavior, guideThe IE6 would mistakenly assume that the page was refreshed or redirected, and that all current connections were interrupted, so that the new load was aborted. The simplest way to solve the solution is two, one is to use the A label <a href= "xxx" (); return false; The other is to use DIV to replace a tag. At this point, the problem is solved.

Solution 1 does not use OnClick, but you must guarantee that the handler function does not return a value, otherwise the browser clears the page and displays only the results of the function. False is displayed in the browser if test returns false.   < a class= "Sub-button" href= "Javascript:test" (); ></a > 2. Add return false on OnClick to prevent the browser from executing href. The href attribute is still required, otherwise the link is not valid for the style

<div class= "Submit-back" >
<a class= "Sub-button" href= "Javascript:void" (0); "onclick=" return false; " ></a>
</div>


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.