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 - How to save instance state of selected radiobutton on menu -

python 3 IndexError: list index out of range -

IF statement in MySQL trigger -