MouseEvent.mozInputSource is a read-only number (Firefox) that tells you which kind of device generated the event — mouse, pen, touch, keyboard, and a few others.
Read the notes below before you rely on this property. Prefer feature detection when support is limited.
Syntax
Use event.mozInputSource. Start with this line.
JavaScript
event.mozInputSource
Call
What it does
event.mozInputSource
Primary signature.
Built into the browser. Read event.mozInputSource on a MouseEvent — no import required.
Listen for pointerdown. Pointer Events unify mouse, pen, and touch.
Read pointerType. You get a clear string: "mouse", "pen", or "touch".
Optionally read moz. Only if the number exists — never required for the main branch.
Production tip. Build product logic on pointerType; treat mozInputSource as Firefox bonus detail.
Compatibility
Browser Support
MouseEvent.mozInputSource is Non-standard and mainly available in Firefox. Other engines typically omit it. Prefer PointerEvent.pointerType for production.
✓ Non-standard · Firefox
MouseEvent.mozInputSource
Mozilla-specific device-source number — useful for learning and Firefox-only debugging, not for cross-browser product logic.
LimitedFirefox-focused
Mozilla FirefoxSupported · Gecko
Supported
Google ChromeNot supported · Usually undefined
No support
Apple SafariNot supported · Usually undefined
No support
Microsoft EdgeNot supported · Usually undefined
No support
OperaNot supported · Chromium-based
No support
Internet ExplorerNot supported
No support
mozInputSourceLimited
Bottom line: Feature-detect before use. For mouse vs pen vs touch in real apps, use standard Pointer Events (pointerType).
Frequently Asked Questions
It is a non-standard, read-only number (mainly Firefox) that describes which kind of device generated the mouse event—for example a real mouse, a tablet pen, a touch screen, or a keyboard.
MDN marks it Non-standard — not part of any specification. It is not labeled Deprecated or Experimental, but you should not rely on it in production cross-browser code.
MDN lists: 0 unknown, 1 mouse, 2 pen, 3 eraser, 4 cursor, 5 touch, 6 keyboard. In Firefox these match MouseEvent.MOZ_SOURCE_* constants when available.
Prefer the standard Pointer Events API: PointerEvent.pointerType returns "mouse", "pen", or "touch". It works across modern browsers.
Touch and pen coordinates can be less precise than a mouse. Knowing the device helps you adjust hit targets, skip hover-only UI on touch, or change accuracy assumptions.
No. It is a Mozilla-specific extension. In Chrome, Safari, and Edge the property is usually undefined. Always feature-detect before reading it.