Notification When Chrome Exits [duplicate] - javascript

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Event onBrowserClose for Google Chrome?
Is it possible to detect when the user exits the Chrome browser, so I can process some data right before they exit? I have looked into using chrome.windows.onRemoved.addListener(function(integer windowId) {...}); but it only listens for a window and not the entire browser.

Well, no.
There is no Close event, and Chrome doesn't guarantee that all others pending events will be fired before closing (will be fired at all).
I personally researched this topic while writing the "History Eliminator" extension, that would erase your browser history on close.

Related

How do I handle user leaving/closing the page effectively? [duplicate]

This question already has answers here:
Intercept page exit event
(4 answers)
Closed 9 years ago.
Okay, I have a live application, it runs a messenger and I am trying to find the most reliable way to determine if a user has navigated away from the page or closed the window, et cetera. I have already implemented this:
window.onbeforeunload = function(event){ /* my code */ };
But that isn't always very reliable, sometimes it will fire and sometimes not. Is there a more reliable way of determining user presence or lack thereof?
Have the browser ping the server every X minutes. If you're making a chat client you'll likely have all the infrastructure you need already.

How to track user hits back button on the browser [duplicate]

This question already has answers here:
Track when user hits back button on the browser
(7 answers)
Closed 9 years ago.
I want to track event which fire on, when user hits back button on the browser.
I found many post related this but all suggest use of .onbeforeunload event. but this event also fire on, when page is refresh or browser window is closed.
If there is any idea to track only browser back event.
Thanks for your help...!!!
You can use History.js:
http://balupton.github.io/history.js/demo/
History.js gracefully supports the HTML5 History/State APIs
(pushState, replaceState, onPopState) in all browsers

How can I specify a hotkey for my browser action? [duplicate]

This question already has answers here:
Open Browser Action's Popup with keyboard shortcut
(3 answers)
Closed 5 years ago.
Is it possible to specify a hotkey that will activate a Google Chrome browser action?
No, you can manipulate almost every other aspect of the browserAction and the popup (including closing it) but it cannot be triggered programatically.
#hamczu is right that the only way to bind global keyboard shortcuts is to inject a Content Script that listens for keystrokes in every page.
However you will not be able to make those keystrokes (or anything else) trigger the browserAction.
I think you should look to Vimium project source. Global hotkeys are done by binding keyboard events in content script and communicate to background page. As authors say in Wiki there is no way "to add global keyboard shortcuts (without using a content script)".
Unfortunately I have found related issue in the bugtracker and it seems there is no way to so so.
The chrome.commands api enables the user to bind hotkeys (with your suggestion for the hotkey) that will trigger commands such as opening the browser action.
Duplicate of answer.

JavaScript detect hash select/copy [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Detect focus on browser address bar?
Simple question. My guess is that it isn't possible, but still doesn't hurt to ask:
Does anyone know if it is possible to detect the following events:
click in the URL bar
URL bar text is selected
URL bar text keypress
URL bar text copy to clipboard
None of these are possible. You can't detect events on the browser window as event handling is limited to the document.
You can somehow intercept this kind of events in Firefox, using XUL, but only in the context of an extension (maybe it's possible to do the same in Chrome too).
see:
Responding to address bar key events in Firefox Add-on
There's no way to intercept these events from the loaded page.

Cross browser window close event [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Close /Kills the seesion when close the browser or tab
Is there a solution for cross browser event. I need to check if user closes their window and to throw an ajax request to my database to sign them out.
I've looked everyone but most cases its not working in all browsers. Anyone have a solution? Or Alternative on how to do this perhaps a conditional statement depending on the browser?
Thanks!
I don't think such a thing exists. You can try an onunload, but that also fires when you refresh the page. This question has been the bane of many that want to do what you're asking for.

Categories