[HTML5] Detecting whether the UA (browser) can accept HTML 5
ian at hixie.ch
Thu Jun 14 12:30:41 PDT 2007
On Fri, 15 Jun 2007, Brian Smith wrote:
> HTML 5 defines new ways to do things that we have been doing in HTML 4
> for years. For example, <INPUT TYPE='email'> is a new, presumably
> better, alternative to <INPUT TYPE='text'> to get an email address from
> the user. I would like to use it whenever possible, but fall back to
> <INPUT TYPE='text'> when the browser doesn't support it.
Just use <input type=email>. The older browsers will automatically default
to <input type=text> if they don't support 'email'.
> In particular, I would like to author my documents in HTML 5, use an
> XSLT transform to convert them to HTML 4, and then serve the HTML 5
> document to browsers that understand it, and the HTML 4 document to
> browsers that don't. But, how do I know whether or not the browser
> understands HTML 5?
Browsers implement parts of HTML5 (and HTML4, for that matter), not the
whole thing at once. However, HTML5 is specifically designed to let you
write a single version of the document that uses HTML5 features and falls
back to HTML4 features where they're not supported, as e.g. described
above for type=email. So you should only need to write one version.
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the Help