Javascript: onbeforeunload is not working -


what wrong in following code?

<script language="javascript">     function abrejanela() {         var janela = window.open("http://www.google.com", "janela", "width=700, height=600");          janela.onbeforeunload = function() {             alert("windows closed");          }     } </script> 

the purpose of onbeforeunload return string, (usually) used prompt user. other actions, alert, may (and are) ignored. please see the mozilla developer network documentation:

since 25 may 2011, html5 specification states calls window.alert(), window.confirm(), , window.prompt() methods may ignored during event. see html5 specification more details.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -