javascript - How to run script in Firefox when a tab was closed? -
at our company using web application shared licenses. unfortunately if closes tab application running in wont release license lock. wondering whether possible run/trigger scipt when firefox tab closed, automatically release licenses? think greasemonkey might able this, haven't found solution yet. there both window.onbeforeunload , window.onunload , used differently depending on browser. can assing them either setting window properties functions, or using .addeventlistener : window.onbeforeunload = function(){ // } // or window.addeventlistener("beforeunload", function(e){ // }, false); usually, onbeforeunload used if need stop user leaving page (ex. user working on unsaved data, he/she should save before leaving).