On Android devices, if you want to create a file input that prompts the
user to either choose an image from their photo album or take a picture with their
camera, you'll need this
poorly documented capture attribute
added to your input:
<input type="file" accept="image/*;capture=camera" />Note that on iOS, the operating system will always show an image picker and the camera
with a type="file" input even if it doesn't have the ;capture=camera directive.
A final note: if you add a capture property
to a file input, like this:
<input type="file" accept="image/*" capture="environment" />...this tells the browser to prefer camera capture over an image picker.
The values can be "environment" or "user".
Thank you for this.
It's a real pain when the underlying behaviour of standard HTML elements gets altered in different browsers. Especially when most of my apps are PWA based, necessitating a new release via a service worker update.