2

How to test using Javascript or by any other means if a browser supports a specific Input type?

For example, if the input type is email, which is currently supported by both chrome and Firefox, while date and number types, are supported only by chrome and not by firefox. So, Is there a way to check if a specific input type is supported by a browser, so that I can write my own javascript if default validation is not available?

promaxdev
  • 455
  • 1
  • 6
  • 19
  • 1
    check this question http://stackoverflow.com/questions/6731303/how-to-detect-html-5-compatibility-in-browser – Prog Mania Jun 02 '13 at 11:42
  • 1
    Check @Prog Mania link, and if you want more information about it, you can read http://diveintohtml5.info/detect.html where there's an explanation on how to detect it on INPUT TYPES Chapter (around 3/4 of the page) – ignasi Jun 02 '13 at 11:48
  • Thanks @ProgMania I had already checked Mordernizr. I Just didnt want to mess up with one more JS library for my app which is already having a gamut of JS libraries for different purposes. – promaxdev Jun 02 '13 at 11:57
  • @ipeiro that link was useful too.. thanks. – promaxdev Jun 02 '13 at 12:03
  • You're welcome. Has helped me a couple of times too :P – ignasi Jun 02 '13 at 12:05
  • But just now i tested for numeric type in firefox. It retains the type attribute - number - in this case. But the validation is not performed by the browser. – promaxdev Jun 02 '13 at 12:10
  • It works @ipeiro .. My mistake was that I tried a shortcut by setting type attribute in the markup and checking the set type from firebug. It failed when i tried to set it using JS code. Sharing this for the sake of others who might do the same mistake. – promaxdev Jun 02 '13 at 12:31

0 Answers0