HTMLInputElement: capture property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The capture property of the HTMLInputElement interface reflects the <input> element's capture attribute. Only relevant to the <input> of type file, the property and attribute specify whether, a new file should be captured from a user-facing (user) or outward facing (environment) camera or microphone. The type of file is defined the accept attribute. If the attribute is not explicitly set, the capture property is an empty string.

Value

A string; Generally either user or environment, or an empty string ("").

Example

js
const inputElement = document.querySelector("avatar");
console.log(inputElement.capture); // the current value of the capture attribute
inputElement.capture = "user"; // sets the capture value

Specifications

Specification
HTML Media Capture
# dom-htmlinputelement-capture

Browser compatibility

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
capture

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

See also