KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am developing an HTML5 app specifically for Android and Chrome . The problem I have stems from the requirement to track open browser tabs. I do this by creating a unique ID stored in each tab's sessionStorage. I then track the open tabs by registering each ID in a localStorage array that each tab has access to. The problem is that I cannot remove the ID from localStorage when closing a tab by using the window.onunload event. The code works fine in desktop Chrome but I cannot get it working in Android. $(window).on('beforeunload', function () { removeWindowGUID(); }); function removeWindowGUID() { var guid = sessionStorage.getItem("WindowGUID"); var tmp = JSON.parse(localStorage.getItem("WindowGUIDs")); tmp = tmp.remove(guid); // remove is a custom prototype fn localStorage.setItem("WindowGUIDs", JSON.stringify(tmp)); } This event will fire when reloading a page, which is fine, just not on closing. I have also tried using the pagehide event.
Tags (comma-separated)
Save Edits
Cancel