I am working on a project using polymer 3 where I want to destroy/clear a cookie and log out the user from the website. Destroying or clearing cookie is not an issue but I am just not able to detect when the browser closes.
So far I have tried:
window.onbeforeunload
from the JavaScript end and for php have tried this:
session_set_cookie_params(0);
but none are working. Any help would be really appreciable.
I can use setInterval()
or setTimeout()
function but it's not fulfilling my requirement.
Plz don't suggest any jQuery suggestion.