What is that event that triggers when a web-page looses focus or gets close? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 4

What is that event that triggers when a web-page looses focus or gets close?

For example when you are on a banking site, and by mistake you click on the close button, it confirms that all the changes will be lost upon closing the page. So what's that event that triggers here? JavaScript course has talked about confirm here but not that event

21st Jul 2017, 4:01 PM
Siddharth Saraf
3 Respostas
+ 4
Try this (link the jQuery firts) : $(document).ready(function() { $(window).bind('beforeunload', function () { return 'Are you sure want to leave this page?'; }); });
21st Jul 2017, 5:09 PM
Mugfirfauzy Siregar
Mugfirfauzy Siregar - avatar
+ 2
try "onbeforeunload"
21st Jul 2017, 4:06 PM
Š’Š°Šæ
+ 2
is that onblur?
21st Jul 2017, 4:06 PM
ŠœŠ³. ŠšŠ½Š°ŠæšŸŒ 
ŠœŠ³. ŠšŠ½Š°ŠæšŸŒ  - avatar