Compatible with Android and Apple Mobile, input phone albums and cameras

Source: Internet
Author: User

In this case, the iphone can be used to adjust the camera and album function, but the Android phone only to adjust the album;

<input id= "Uplicense" onchange= "Preview (this,0)" type= "file" name= "Uplicense" >

<input id= "Uplicense" onchange= "Preview (this,0)" type= "file" Name= "Uplicense" accept= "image/*" capture= "Camera" >

This, however, allows the Android phone to simultaneously bring up the camera and the album, but the iphone can only be adjusted to the camera:

<input id= "Uplicense" onchange= "Preview (this,0)" type= "file" Name= "Uplicense" accept= "image/*" capture= "Camera" Multiple>

So, the combination can be written at the outset:

<input id= "Uplicense" onchange= "Preview (this,0)" type= "file" Name= "Uplicense" accept= "image/*" capture= "Camera" Multiple>

And then in the page JS in this write:

$ (function ()) {

  Compatibleinput ();

}

Determine if the current iOS mobile is compatible with input phone albums and cameras

function Compatibleinput () {
Get the browser's useragent and convert to lowercase
var ua = Navigator.userAgent.toLowerCase ();
Determine if it is an Apple phone, yes it is true
var Isios = (ua.indexof (' iphone ')! =-1) | | (Ua.indexof (' ipad ')! =-1);
if (Isios) {
$ ("Input:file"). Removeattr ("capture");
};
}

Compatible with Android and Apple Mobile, input phone albums and cameras

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.