Forum Moderators: open

Message Too Old, No Replies

Backwards compatibility on <input type="email" or "tel"

         

csdude55

6:58 am on Jun 3, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I see that these field types help to validate the information entered, which is great... but I can't find how older browsers handle them.

Since I don't have access to IE9 myself, do you guys and gals have any idea how IE8 or IE9 would handle a tag like <input type="email">? Would it just ignore it and pretend that it's type="text"?

not2easy

12:39 pm on Jun 3, 2020 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Or you could test it at caniuse? [caniuse.com...]

lucy24

3:10 pm on Jun 3, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Reassuringly, caniuse does say
Browsers without support for these types will fall back to using the "text" type.
--which is what browsers are supposed to do anyway when they meet anything in CSS or HTML that they don’t understand. That is, either ignore the part they don’t know, or fall back on the default, in this case "text".

How I got there: #search=input%20type%3Demail

NickMNS

4:47 pm on Jun 3, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I like to use mozilla.org for compatibility and general information. Here are the links:
[developer.mozilla.org...]
[developer.mozilla.org...]

The browser compatibility table is at the bottom of the page. Spolier IE 10+. The second "tel" link has a note confirming what Lucy said. In addition, there is a lot more information shown about how these types are handled in the various browsers. There is also the standard and important warnings about client side form validation.

csdude55

8:18 pm on Jun 3, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks! I couldn't figure out how to find it on caniuse :-/ But mozilla gave me a lot more info! So thanks for both of those :-)

Follow up question... if I set a style to something like:

input[type="email"] { foo: bar }


Am I correct that IE8/9 would still apply it, even though they don't recognize the type?

lucy24

9:01 pm on Jun 3, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



To be safe, find a computer with MSIE 8 and try it. The form
input[type=blahblah]
is a good old-fashioned CSS2.1 selector (caniuse lists them separately from the longer CSS 3 group), which is supposed to be supported back to MSIE 7 (seven). That's assuming the browser simply looks at the existence and value of the selector, independent of its ability to use the specified selector/value pair. I am always hesitant making these assumptions about MSIE <= current-version, which is why it's safer to try it out.