Delete cookie in browser close not on refresh page
I have seen many posts regarding the same problem, but I am not getting the exact solution. I want to delete a cookie in the browser or close a tab using javascript. I made a cookie delete function and called the onbeforeunload event . But I saw that this event also triggered when a page refresh I don't want to delete the cookie on the refresh page. And I have seen in many posts that they detect link, F5 keypress event and form submit and prevent the onbeforeunload event. But then how about the refresh button click and hit enter on the url bar. Therefore, I believe that this is not an exact solution. so help me to solve this problem.
Additional info: I am creating a cookie using PHP and I want to delete this cookie in the browser.
+3
source to share
3 answers