admin管理员组文章数量:1335598
Is there any way to detect mobile browser close event? I need to forcefully delete a cookie on browser close. I have already tried my luck with window.onbeforeunload
and window.unload
but they doesn't work for mobile browsers. Search on the web a lot but didn't get any solution.
Thanks in advance
Is there any way to detect mobile browser close event? I need to forcefully delete a cookie on browser close. I have already tried my luck with window.onbeforeunload
and window.unload
but they doesn't work for mobile browsers. Search on the web a lot but didn't get any solution.
Thanks in advance
Share Improve this question asked Feb 11, 2015 at 8:54 Ankur AggarwalAnkur Aggarwal 3,1015 gold badges33 silver badges57 bronze badges 8- set a cookie with a past expires time ? – Hacketo Commented Feb 11, 2015 at 8:58
- Are you killing the browser tab ? – Mukesh Agarwal Commented Feb 11, 2015 at 8:59
- @Hacketo I need to do that after I get the close event. – Ankur Aggarwal Commented Feb 11, 2015 at 9:00
- This wouldn't work anyway. What if I just pulled the battery? Ask yourself this: If I don't want the data to be persistent, should I really be storing it in a cookie? – CodingIntrigue Commented Feb 11, 2015 at 9:00
- @RGraham Its kinda flag kind thing which I need across all the pages. I am not storing any data – Ankur Aggarwal Commented Feb 11, 2015 at 9:02
2 Answers
Reset to default 3I'm sorry but it's just impossible with Javascript... You can prevent the action of closing tab but not to do something when it will be close...
How to Detect Browser Window /Tab Close Event?
Use $(window).blur(function() for mobile browsers.
本文标签: javascriptDetect Mobile Browser Close EventStack Overflow
版权声明:本文标题:javascript - Detect Mobile Browser Close Event - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742393913a2466537.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论