The input[type="date"] in Internet Explorer (IE) 9 and 10

30. January 2013 09:26 by Mrojas in HTML5, IE  //  Tags: , , , , , , , , , , ,   //   Comments (0)

Well, yes yes. IE is becoming better and has more support for HTML5 features but... still a lot of things do not work.

And that is very normal, browser will start adopting HTML5 little by little.

In case you want to use HTML5 feature not supported by your browser (which usually will be IE) then use two things:

  • Feature Detection and
  • Polyfills.

Feature Detection is the ability to determine if an HTML5 feature is supported or not by our browser. A good library for that is Modernizr. What you can do with modernizr is detect if any feature that you need is not supported and if not then you can conditionally load some javascript libraries that will implement that feature. Those libraries are called Polyfills.

So for example if you want to use the <input type="date" /> tag in IE 10 you could use the controls to provide a date picker.

		nope: "js/jquery-ui.custom.js",
		callback: function() {
Figure 1: Modernize script to test is the date type is supported

 Modernizr tests is the feature is supported, optionally you can use the nope to indicate if there is a library that you wan t to load ONLY if the feature is not supported, and callback is code that will be called after the test and after loading the library.


And this is the screenshot:


Figure2: Screenshot of IE10 with date picker
This technique can be used for a lot of other features. A good (but a little old article about that can be found HERE)
I have uploaded some test code if you want to test this quickly. (148.76 kb)