javascript - Window onbeforeunload just displays the conformation message but cannot be triggered to function called in it -


window onbeforeunload displays conformation message cannot triggered function called in it. conformation message showing in chrome, safari not in mozilla.

i tried below code:

function submitform(){   $('#appstrm').submit(); }  window.onbeforeunload = function(e) {  submitform();  var dialogtext = 'dialog text here';  e.returnvalue = dialogtext;  return dialogtext; }; 

in chrome, safari conformation popup appears sumbitform() not triggered. in mozilla, no conformation popup appears. please suggest , thanx in advance

form.submit() asynchronous operation handover control other child thread , proceeds next inline operation, performs operation , without waiting asynchronous operation complete killed main thread , main thread in result kill child threads.

try make submit() method synchronous using deffered make promise , in then of returned promise call show dialogue operation.

https://api.jquery.com/deferred.promise/


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -