Xenorosth Xenorosth - 1 year ago 90
Javascript Question

How to capture Mouse and Keyboard data across all websites for Chrome

Just as the title implies. How would I go about capturing general event data across websites? This is supposed to be a strictly client-side application. Would a chrome extension work? If so, how would I go about it? Does one already exist, or at least an alternative method?

Answer Source

In chrome extension, Content scripts are scripts that run in the context of web pages. You could listent to specific events (such as MouseEvent and KeyboardEvent ) just like normal scripts.


  "manifest_version": 2,
  "name": "Test extension",
  "version": "1.0",
  "content_scripts": [
      "matches": [
      "js": [
      "all_frames": true


document.addEventListener('mousedown', function (e) {
    console.log('mouse down');
}, false);

document.addEventListener('keydown', function (e) {
    console.log('key down');
}, false);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download