<input type="file" capture="camera" accept="image/*">
allows a mobile browser to take a picture. On Android native browser and chrome, clicking the input button launches the camera instantly. On iOS Safari, the button launches an alert asking to "Take Photo" or choose from "Photo Library". How can I launch the native camera immediately?
It's not possible on iOS at this time.
iOS6 through 10 do not support the capture
attribute which is meant to force the user agent to use the camera, not the "Photo Library".
The capture
attribute is part of HTML Media Capture.
PS: You could improve your code by replacing capture="camera"
with just capture
. In 2012 the capture attribute was changed from 4 strings to boolean in the HTML Media Capture spec.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With