navigator.requestMIDIAccess() asks for access to MIDI devices (keyboards, controllers, synths). If permission is granted, the Promise resolves to a MIDIAccess object with inputs and outputs.
Pass the required arguments shown below. Check return values and browser support before you rely on the result.
Syntax
Call navigator.requestMIDIAccess. Start with this line.
JavaScript
navigator.requestMIDIAccess(options?)
Call
What it does
navigator.requestMIDIAccess(options?)
Primary signature.
navigator.requestMIDIAccess(...)
Call with the arguments your case needs.
Built into the browser. Call requestMIDIAccess(...) on a Navigator — no import required.
prompt
(or granted / denied / error if unsupported)
How It Works
Use Permissions API. MDN shows { name: "midi", sysex }.
Read state.prompt means the next access call may ask the user.
Catch query failures. Not every browser exposes midi to permissions.query.
Still request. Query is optional — requestMIDIAccess() is the real gate.
Compatibility
Browser Support
Navigator.requestMIDIAccess() is part of the Web MIDI API. MDN marks it Limited availability (not Baseline). Requires a secure context.
✓ Limited availability
Navigator.requestMIDIAccess()
Supported in Chromium-based browsers and some others with varying completeness. Safari historically lacked Web MIDI — always feature-detect.
LimitedNot Baseline
Google ChromeModern versions (secure context)
Yes
Microsoft EdgeModern versions (secure context)
Yes
OperaModern versions (secure context)
Yes
Mozilla FirefoxLimited / check version
Partial
Apple SafariLimited or unavailable
Partial
Internet ExplorerNot supported
No
requestMIDIAccess()Feature-detect required
Bottom line: Ship MIDI UI only after detecting the method and handling permission errors. See the MDN requestMIDIAccess() reference.
Frequently Asked Questions
It asks the browser for access to MIDI devices. If permission is granted, the Promise resolves to a MIDIAccess object with inputs and outputs maps.
No. MDN does not mark it Deprecated, Experimental, or Non-standard. It is Limited availability (not Baseline) and requires a secure context.
If MIDIOptions.sysex is true, the app may send and receive System Exclusive messages. The default is false. Sysex often needs extra permission scrutiny.
Usually yes on first use (or the browser reuses a previous choice). Access can also be blocked by the midi Permissions Policy.
After access resolves, iterate access.inputs.values() and access.outputs.values() to read MIDIInput / MIDIOutput ports (name, manufacturer, state, and more).
Often via navigator.permissions.query({ name: "midi", sysex: true|false }) when the Permissions API supports the midi permission in that browser.