Fixing the IE8 Double Click Bug

The Big Blue E
The Big Blue E (Photo credit: sbisson)

In Internet Explorer 9 & higher, there is a bug in handling form based javascript written for IE8. One of the side effect is that for ‘Forms’ with ‘Submit’ Buttons, it can cause a ‘Double Click Action’ on Submit.

This action can cause unexpected behavior on webpages designed primarily for IE8. There are a couple of ways to work around the issue. One simple JS fix is to replace the onclick call to something like this:

onclick="this.disabled=true; /*Do Required operation*/ return false;"
{adinserter 3}
Other options include, using a js listener to catch the click event and prevent it from double clicking.
Also changing the type of the button from “Submit” to Button apparently reduces the probability of this error recurring.

Enhanced by Zemanta