When using an <input type="file"/> field the behavior on Android is inconsistent with iOS.
Default <input> field
A default <input> file field produces the following on iOS, with options for all three pickers: Photo Library, Take Photo, and Choose File.
<input type="file" accept="image/*"/>
Input field
Three options
Selecting each option, in turn, produces the correct picker.
Photo Library
Take Photo
Choose File
The same markup on Android navigates the user directly to the photo library picker.
Input field
Photo Library
The capture attribute
Adding capture to the <input> field adds the additional camera option to Android.
<input type="file" accept="image/*" capture/>
Input field
Two options
However, on iOS adding the capture attribute skips the options selection and goes directly to the camera.
Input field
Take Photo
According to the documentation, capture should have a value of user or environment. It doesn't seem to matter what value, if any, is set. The same behavior described above occurs on both platforms.
It's worth nothing that there is zero custom Swift code related to handling these fields - everything is coming directly from WKWebView. It looks like Android has code related to "capturing" but I couldn't figure out why some intents would show when others wouldn't.
When using an
<input type="file"/>
field the behavior on Android is inconsistent with iOS.Default
<input>
fieldA default
<input>
file field produces the following on iOS, with options for all three pickers: Photo Library, Take Photo, and Choose File.Selecting each option, in turn, produces the correct picker.
The same markup on Android navigates the user directly to the photo library picker.
The
capture
attributeAdding
capture
to the<input>
field adds the additional camera option to Android.However, on iOS adding the
capture
attribute skips the options selection and goes directly to the camera.According to the documentation,
capture
should have a value ofuser
orenvironment
. It doesn't seem to matter what value, if any, is set. The same behavior described above occurs on both platforms.It's worth nothing that there is zero custom Swift code related to handling these fields - everything is coming directly from
WKWebView
. It looks like Android has code related to "capturing" but I couldn't figure out why some intents would show when others wouldn't.