0

I need the event will fire only when I close the browser tab.I had beforeunload function but it is working for both close and refreshes the page.Below you can see the code I tried only for the close tab but it is not working.

Code here,

function handleWindowClose()
{
  if ((window.event.clientX < 0) || (window.event.clientY < 0)) {
    localStorage.removeItem('key');
  }
}
$(window).bind("beforeunload", function() { 
  handleWindowClose();
})
Karthick
  • 433
  • 1
  • 10
  • 25

0 Answers0