coderef

HTML media captureLimited availability

The capture HTML attribute for <input type="file"> elements allows the user to capture media using the device's camera or microphone.

Not yet supported in all major browsers — check the table and provide a fallback.

Browser support

DesktopChrome
✕Not supportedup to 155
Current: 155
Edge
✕Not supportedup to 154
Current: 154
Firefox
✕Not supportedup to 157
Current: 157
Safari
✕Not supportedup to 27
Current: 27
MobileChrome Android
18–18Not supported
25+Supportedsince Feb 27, 2013
Current: 155
Firefox Android
4–68Not supported
79+Supportedsince Jul 28, 2020
Current: 157
Safari iOS
1–9.3Not supported
10+Supportedsince Sep 13, 2016
Current: 27

How to use

Not supported in Chrome, Edge, Firefox, Safari. Use feature detection below and provide a fallback (or a polyfill) for those browsers.

Example

Full syntax and examples are on MDN: capture.

Feature detection

JS · check before using
if ("HTMLInputElement" in globalThis && "capture" in HTMLInputElement.prototype) {
  // HTMLInputElement.capture is available
}

Sub-features

Support for each part of the feature (2). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
HTMLInputElement.capture✕✕✕✕257910
input.capture✕✕✕✕257910