You can detect clicks inside the page with a simple event handler click:
document.onclick= function(event) {
if (event===undefined) event= window.event;
var target= 'target' in event? event.target : event.srcElement;
alert('clicked on '+target.tagName);
};
It is not possible for the web page script to detect clicks outside the page, such as the back button and another Chrome browser, for security reasons. To do this, you must be part of a browser extension.
source
share