Reputation: 43
I've been using these two, which mostly work well:
$(window).on('beforeunload', function() {});
$(window).on('unload', function() {});
I use SignalR, and these trigger a function on the server which removes a record in a database. However, investigating the database when the page is live reveals that some records do not get removed. I also know I've got quite a few mobile users. Could there be a problem with mobile browsers not triggering these events? I hope there is something I can do to fix this.
Upvotes: 1
Views: 604
Reputation: 2345
The term "closes mobile browser window" can mean many things...
etc.
Not all these actions may trigger the beforeunload
or unload
events in the browser tab and unfortunately, you do not have any way to intercept some these actions
Your only viable option is to perhaps look into other ways of doing what you are trying to accomplish with the unload
events...
Upvotes: 1