For preventing the submit button's double click, I wrote the following function which is called on the form's onsubmit event.
<script language="JavaScript">
var submitFlag = false;
function checkForm(){
if ( submitFlag == false ) {
submitFlag = true;
return true;
} else {
alert('double click');
return false;
}
}
</script>
<form name="f1" method="post" action="B.jsp" onSubmit="return checkForm()">
In Internet Explorer, when I click the submit button twice, alert method occurs. If I don't click the okay button in the alert box, the jsp isn't redirected.
However in Firefox, the alert box is very fast, I have no time to click the ok button. The jsp is redirected very fast, and the second request has been sent out.
How can I block the request from going through in Firefox?