How could I check with “simple” JavaScript if the browser supports the HTML5 input type attribute color? (Note: I don’t want to use Modernizr)
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A good way can often be to look through the Modernizr source code. Here is the relevant chunk:
Cut down to just detect type=”color”,
As you can see, it’s not the most trivial thing, and can change; that’s why including something like Modernizr can be a good idea.