October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

Can JavaScript Measure Mouse Polling Rate?

A web page can estimate the pointer samples a browser exposes, but not a mouse's hardware polling rate. Here is how to run the test and read it correctly.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Not directly. JavaScript running in a web page can estimate how many pointer samples the browser passes to the page each second while the mouse moves. That figure is a useful browser-side estimate, but it is not a readout of the mouse’s hardware polling rate.

Why the browser sits between the mouse and your code

A mouse reports its position to the operating system at its own polling rate. The operating system and browser then decide what reaches a web page, and when. A page never sees the raw report stream from the device. It only sees pointer events that the browser has dispatched.

As an Amazon Associate I earn from qualifying purchases.

That gap matters because the browser may merge several pointer changes into one dispatched event. The W3C Pointer Events specification describes this coalescing, and it leaves the details to each browser. In the specification’s words, it “does not define how user agents should coalesce or predict pointer movement data.” Two browsers, or the same browser on two operating systems, can therefore expose different numbers of samples for the same physical movement.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What a page can observe

Dispatched event count

The simplest approach listens for pointermove and counts how many times the handler runs. This is easy to write, but it undercounts whenever the browser has merged several movements into one event. It measures browser dispatch, not mouse reports.

#1 Best Overall
Sale
Logitech G305 Lightspeed Wireless Gaming Mouse - Black
  • The next-generation optical HERO sensor delivers incredible performance and up to 10x the power efficiency over previous generations, with 400 IPS precision and up to 12,000 DPI sensitivity
  • Ultra-fast LIGHTSPEED wireless technology gives you a lag-free gaming experience, delivering incredible responsiveness and reliability with 1 ms report rate for competition-level performance
  • G305 wireless mouse boasts an incredible 250 hours of continuous gameplay on just 1 AA battery; switch to Endurance mode via Logitech G HUB software and extend battery life up to 9 months
  • Wireless does not have to mean heavy, G305 lightweight mouse provides high maneuverability coming in at only 3.4 oz thanks to efficient lightweight mechanical design and ultra-efficient battery usage
  • The durable, compact design with built-in nano receiver storage makes G305 not just a great portable desktop mouse, but also a great laptop travel companion, use with a gaming laptop and play anywhere

Coalesced samples with getCoalescedEvents()

The Pointer Events API provides getCoalescedEvents() on a pointer event. It returns the underlying samples that the dispatched event represents, in supporting browsers. Each sample carries its own timestamp, so a test can count the samples the browser exposed rather than the handler calls. This gives a finer estimate, but it still stops at the browser. The browser decides how much of the device’s movement history it keeps.

pointerrawupdate

The pointerrawupdate event is another option for a test to listen for. Whether it fires in a given browser, and how its timing compares with pointermove, depends on the implementation. Check support in the browser you are testing before you rely on it.

Rank #2
Sale
Logitech G502 Hero Wired Gaming Mouse - Black
  • HERO Gaming Sensor: Next generation HERO mouse sensor delivers precision tracking up to 25600 DPI with zero smoothing, filtering or acceleration
  • 11 programmable buttons and dual mode hyper-fast scroll wheel: The Logitech wired gaming mouse gives you fully customizable control over your gameplay
  • Adjustable weights: Match your playing style. Arrange up to five 3.6 g weights for a personalized weight and balance configuration
  • LIGHTSYNC technology: Logitech G LIGHTSYNC technology provides fully customizable RGB lighting that can also synchronize with your gaming (requires Logitech Gaming Software)
  • Mechanical Switch Button Tensioning: A metal spring tensioning system and metal pivot hinges are built into left and right computer gaming mouse buttons for a crisp, clean click feel with rapid click feedback

How to run a browser-side estimate

A reasonable test looks like this:

  1. Open a plain page in the browser you want to test, on a secure origin (HTTPS or localhost), because getCoalescedEvents() is restricted to secure contexts where it is implemented.
  2. Open the developer console, paste the script below, and press Enter.
  3. Move the mouse in a continuous, steady motion for the full five seconds. Stopping early or moving in short bursts gives a number that describes the burst, not the device.
  4. Read the value that appears in the console. Repeat the test two or three times and compare the results before drawing a conclusion.
const samples = [];
const canCoalesce = window.isSecureContext && typeof PointerEvent !== 'undefined' && 'getCoalescedEvents' in PointerEvent.prototype;

document.addEventListener('pointermove', (event) => {
  const list = canCoalesce ? event.getCoalescedEvents() : [event];
  for (const s of list) samples.push(s.timeStamp);
});

setTimeout(() => {
  if (samples.length < 2) return console.log('Not enough movement samples');
  const seconds = (samples[samples.length - 1] - samples[0]) / 1000;
  if (seconds <= 0) return console.log('Timestamps did not advance');
  console.log('Browser-exposed samples per second:', ((samples.length - 1) / seconds).toFixed(1));
}, 5000);

If the page is not a secure context, or the method is missing, the script falls back to counting dispatched events. That fallback is coarser, and the label on its output should say so.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why requestAnimationFrame gives the wrong answer

A common shortcut is to count requestAnimationFrame() callbacks per second. Do not use that count as a polling rate. According to MDN, animation-frame callbacks generally run at the display’s refresh rate, and most browsers pause them in background tabs and hidden iframes. The number you get reflects the screen’s refresh scheduling, not how often the mouse reports its position.

Rank #3
Sale
Logitech G305 Lightspeed Wireless Gaming Mouse - White
  • Next-gen 12,000 DPI HERO optical sensor delivers unrivaled gaming performance, accuracy and power efficiency
  • Advanced LIGHTSPEED wireless gaming mouse for super-fast 1 ms response time and faster than wired performance
  • Ultra-long battery life gives you up to 250 hours of continuous gaming on a single AA battery
  • Lightweight mechanical design and classic shape for maximum maneuverability, durability and comfort
  • Compact, portable design with convenient built-in storage for included USB wireless receiver

Comparing the three ways to count

Method What it counts Suitable for estimating mouse report rate?
Count of pointermove handler calls Dispatched events after browser coalescing Low. Undercounts whenever several movements are merged
Samples from getCoalescedEvents() Underlying samples the browser exposes, each with a timestamp Best available in-browser estimate, where supported
Count of requestAnimationFrame() callbacks Frame scheduling tied to display refresh No. Measures display scheduling, and pauses in background tabs

Reading the result honestly

A number from this kind of test describes what one browser, on one platform, exposed to one page during one movement. Treat it as an observed rate under those conditions. Do not present it as a certified specification for the mouse. The mouse’s own report rate can be checked only through the manufacturer’s specifications or software that reads the device directly, which a web page cannot do.

Expect the result to change with the browser, the operating system, the page’s load during the test, and how you moved the mouse. A result that is much lower than the mouse’s advertised rate is not proof that the mouse is underperforming. It may reflect what the browser chose to expose.

Rank #4
Sale
Razer Basilisk V3 Customizable RGB Wired Ergonomic Gaming Mouse, Black
  • ICONIC ERGONOMIC DESIGN WITH THUMB REST — PC gaming mouse favored by millions worldwide with a form factor that perfectly supports the hand while its buttons are optimally positioned for quick and easy access
  • 11 PROGRAMMABLE BUTTONS — Assign macros and secondary functions across 11 programmable buttons to execute essential actions like push-to-talk, ping, and more
  • HYPERSCROLL TILT WHEEL — Speed through content with a scroll wheel that free-spins until its stopped or switch to tactile mode for more precision and satisfying feedback that’s ideal for cycling through weapons or skills
  • 11 RAZER CHROMA RGB LIGHTING ZONES — Customize each zone from over 16.8 million colors and countless lighting effects, all while it reacts dynamically with over 150 Chroma integrated games
  • OPTICAL MOUSE SWITCHES GEN 2 — With zero unintended misclicks these switches provide crisp, responsive execution at a blistering 0.2ms actuation speed for up to 70 million clicks

If the browser exposes samples with timestamps, the same script can also show whether movement arrives in regular intervals or in bursts. Irregular spacing is often more informative than the average.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting a result that looks wrong

  • The value is zero or the script reports too few samples: The page did not receive pointer movement. Make sure the page has focus and that the mouse actually moved during the five seconds.
  • The value changes a lot between runs: Movement speed and steadiness affect the sample count. Use the same motion each time, or repeat the test several times and compare.
  • The value is identical in two browsers on the same machine: The browsers may be exposing the same underlying samples, or one may not support getCoalescedEvents(). Check the console output to see which path ran.
  • The test ran in a background tab or hidden frame: Discard the result. Run the page in the foreground window.

The short version is that a browser can tell you how many pointer samples it hands to a page. It cannot tell you how many times the mouse itself reported.

Best Value
Sale
Redragon M612 Wired RGB Optical Gaming Mouse 8000 DPI Remapping Keys
  • Pentakill, 5 DPI Levels - Geared with 5 redefinable DPI levels (default as: 500/1000/2000/3000/4000), easy to switch between different game needs. Dedicated demand of DPI options between 500-8000 is also available to be processed by software.
  • Any Button is Reassignable - 11 programmable buttons are all editable with customizable tactical keybinds in whatever game or work you are engaging. 1 rapid fire + 2 side macro buttons offer you a better gaming and working experience.
  • Comfort Grip with Details - The skin-friendly frosted coating is the main comfort grip of the mouse surface, which offers you the most enjoyable fingerprint-free tactility. The left side equipped with rubber texture strengthened the friction and made the mouse easier to control.
  • 5 Decent Backlit Modes - Turn the backlit on and make some kills in your gaming battlefield. The hyped dynamic RGB backlit vibe will never let you down when decorating your gaming space, it would be better with other Redragon accessories with lights on.
  • Fatigue Killer with Ergonomic Design - Solid frame with a streamlined and general claw-grip design offers a satisfying and comfortable gaming experience with less fatigue even though after hours of use.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.