I googled it before, but i could not find any solution about detecting only window closing event instead of tab closing and refresh events in JavaScript.