It works for Firefox and Chrome though Not very sure what is the reason. Using jsp in apache tomcat.
form code is as below
<form id="form1" method="POST" action="zzz.jsp?yy=submit">
<input type="button" name="submit" id="submit" value="Submit" onclick="Submitconfirm()" />
</p>
</form>
javascript of Submitconfirm
function Submitconfirm() {
var a = document.getElementById("form1");
if (confirm()) {
a.submit();
}
}
function confirm() {
return confirm('Are you sure these details are correct?');
}
jsp does not have postback function so I had to resort to this,on submit will execute javascript to send the form.