I want to execute some code when user close their browser. I found some piece of code and try it, but it is not working. I notice that it is working when I am clicking on Run link at jsfiddle. I dont know why.
$(function(){
$(window).on('beforeunload', function(){
alert(0)
})
})