Bind a global click or mouseup event listener. Then, use canvas to obtain the pixel information. The pixel positions can be retrieved through the event object (event.pageX, event.pageY).
See below for an example, which should work in future versions of FireFox. Currently, for security reasons, the drawWindow method is disabled for web pages. It should work in extensions, though. If you're truly interested, see the links for the similar methods in Chrome, Safari and Internet Explorer.
var canvas = $("
References
- Canvas examples - Learn more about
canvas
- drawWindow - FireFox method
- visibleContentAsDataURL - Safari extensions
- chrome.tabs.captureVisibleTab - Chrome extensions
- HTA ActiveX control - Internet Explorer