Note that there are some explanatory texts on larger screens.

plurals
  1. POwindow.onbeforeunload support in Firefox
    primarykey
    data
    text
    <p>I am using window.onbeforeunload in my javascript. This works perfectly in IE but is not triggered in Firefox.</p> <p>I checked on different links in stackoverflow.... In it I read that window.onbeforeunload is not supported by firefox. Is this true?</p> <p>If yes, can you please tell me a different way to call app.deleteAccount(key) on close of browser. Here is my javascript. Please look at the deleteFile() and dontDeleteFile() methods.</p> <pre><code>&lt;script type="text/javascript"&gt; //Event handler for body onload function confirmDeleteFile(){ var secured =document.r_form.Secure[1].checked; alert("confirmDeleteFile : "+secured); if(secured){ var agree=confirm("Are you sure you wish to continue?"); if (agree){ //document.form1.submit(); return true; } else return false ; } // submitForm(); return true; } function deleteFile() { alert('inside deleteFile() but outside window.onbeforeunload'); window.onbeforeunload = function(){ var key = DOMAIN+'::' + elem('userName').value; alert('inside deleteFile()'); app.deleteAccount(key) alert('Unloading!'); } } function dontDeleteFile() { alert('inside dontDeleteFile() but outside window.onbeforeunload'); window.onbeforeunload = function(){ alert("Not deleting"); } } function validateFormOnSubmit(theForm) { var reason = ""; var userName = theForm.username.value; var pin = theForm.pin1.value; var PAM = theForm.pam.value; var organization = theForm.organization.value; //reason += validateUsername(theForm.username); reason += validateEmpty(theForm.pam); reason += validatePinMatch(theForm.pin1,theForm.pin2); reason += validatePin(theForm.pin1,theForm.pin2); if (reason != "") { if(!confirmDeleteFile()){ return false; } alert("Some fields need correction:\n" + reason); return false; } else{ if(!confirmDeleteFile()){ return false; } &lt;% String url = request.getServerName().toString(); int port = request.getServerPort(); String contextPath = request.getContextPath(); %&gt; var servlet = "arcotebank.az"; //AroctEBanking Servlet var url = BASE_URL + '/' + servlet; var query = 'lang=en&amp;reqid=1&amp;version=1.1'; query += '&amp;device=' + urlEncode(navigator.userAgent); query += '&amp;uid=' + urlEncode(userName); query += '&amp;code=' + urlEncode(PAM); query += '&amp;pin=' + urlEncode(pin); query += '&amp;usePin=' + usePin+'&amp;method=arcotOTPEnroll&amp;organization='+organization; //alert("url=&gt;"+url + '?' + query); var xml = app.openUrl(url + '?' + query) + ''; //alert("xml=&gt;"+xml); if(appError()){ alert("applet error"); } var domain = getDomain(url); app.provisionAccount(domain, xml); if(appError()){ alert("applet error"); } var acc = app.getAccount(DOMAIN + '::' + userName); if(acc!=null){ &lt;%String formSubmitAction1 = URLEncoderDecoder.encodeURL( formAction, "Action.2FA.Arcot.Navigation.LogoutActionCalled=Y",cm);%&gt; theForm.action ='&lt;%=formSubmitAction1%&gt;'; var secured =document.r_form.Secure[1].checked; alert("line 131 "+secured); if(secured){ deleteFile(); }else{ dontDeleteFile(); } theForm.submit(); }else{ document.getElementById("error").innerHTML = "Failed to Create ArcotOTP"; } } } function resetForm(){ var form = document.forms[0]; form.username.value = ''; form.pam.value = ''; form.pin1.value = ''; form.pin2.value = ''; } function validateUsername(fld) { var error = ""; var illegalChars = /\W/; // allow letters, numbers, and underscores if (fld.value == "") { fld.style.background = 'Yellow'; error = "You didn't enter a username.\n"; } else if ((fld.value.length &lt; 5) || (fld.value.length &gt; 15)) { fld.style.background = 'Yellow'; error = "The username should contain more than 4 characters.\n"; } else if (illegalChars.test(fld.value)) { fld.style.background = 'Yellow'; error = "The username contains illegal characters.\n"; } else { fld.style.background = 'White'; } return error; } function validateEmpty(fld) { var error = ""; if (fld.value.length == 0) { fld.style.background = 'Yellow'; error = "You didn't enter Personal Assurance Message \n" } else { fld.style.background = 'White'; } return error; } function validatePin(pin1,pin2){ var error=""; if(pin1.value!=pin2.value){ pin1.style.background = 'Yellow'; pin2.style.background = 'Yellow'; error += "Pin numbers dont match\n"; //alert("Pin numbers dont match"); } return error; } function validatePinMatch(pin1,pin2){ var error=""; if(pin1.value==""){ //elem('otp').style.background = 'Yellow'; pin1.style.background = 'Yellow'; error += "Pin number cannot be empty\n"; //alert("Pin number cannot be empty"); } if(pin2.value==""){ //elem('otp').style.background = 'Yellow'; pin2.style.background = 'Yellow'; error += "Confirm Pin number cannot be empty\n"; //alert("Pin number cannot be empty"); } return error; } &lt;/script&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload