Is there a way to write a js script for automatic log in (when the browser is opened) and automatic log out(when browser is closed) for google chrome extensions using these-
When a new window is opened-
chrome.windows.onCreated.addListener(function(Window window) {...}));
and, when a window is opened-
chrome.windows.onRemoved.addListener(function(integer windowId) {...}));
Source: http://code.google.com/chrome/extensions/windows.html
You are thinking too complicated. In your background page, register event handlers for the
loadandunloadevents. The former will happen when your extension is initialized and the latter when it is shut down. Normally that’s the same as browser start and shutdown (and I guess that you want to treat the case where your extension is uninstalled the same as browser shutdown).