Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 Safari iOS access only camera not photo library

<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?

like image 421
Rich Avatar asked Nov 22 '22 10:11

Rich


1 Answers

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.

like image 109
Octavian Naicu Avatar answered Nov 24 '22 22:11

Octavian Naicu