samedi 31 janvier 2015

Detecting html/js support custom date/select/multiselect input


Sorry, this question might not be the best worded question, please feel free to advice if i should change (if i can change).


Background:


Different browsers/OS's render html differently, we all know this. One of the significant things is, how certain form tags work.


Eg.



<select>
<option>option 1</option>
</select>


In desktop browsers, we see a dropdown, but in ios/android, we see a OS level modal/popup.


Other obvious tags are, multiselect, and input type "date" (nice date selector pops up on ios/android as opposed to the desktop simple text field).


Question:


So as a html/js developer, is there any way to detect if the current browser renders these tags differently?


Eg. its in good practice to let users select date using the most native thing you can, however, its not nice to tell them to type it out. So if the os/browser has a pre-made modal for date, i want to show the native implementation, and if no such implementation exists, then display a custom date picker.


Sure i can use a library to differentiate ios/android/pc, but thats not exactly what im looking for. is there a way to actually check if the browser supports custom behaviour for these tags?





Aucun commentaire:

Enregistrer un commentaire