Monday Mojito: Does my browser support HTML5?

You cannot detect “HTML5 support”, because HTML5 is not one big thing. It is a collection of individual features, like, canvas, video, or geolocation. You can detect support for these.
An easy way to detect support for many HTML5 and CSS3 features is to use Modernizr – an open souce, MIT-licensed JavaScript library. This is how it works:
Download Modernizr from http://modernizr.com
Include the file using the <script> tag in the <head> tag of your file. For example, if you have saved the file in the folder ‘js’ of your code repository, add a link to the file like this:

<head>
    ….
    ….
    <script src = “js/modernizr-latest.js”></script>
</head>

Now, use JavaScript to detect for HTML5 features. For example, to detect if your browser supports the geolocation API:

if (Modernizr.geolocation){
    // I see you
}
else {
    // I can’t locate you
}

About Monday Mojito: Monday (muhn-dey, -dee) – The day of blues,hang overs, fresh beginnings and chilled out programming. Monday Mojitos are bitter lime programming bloopers.
Have a great week ahead! Hack away.
Cheers!
Ace Hacker Team
Advertisements
Monday Mojito: Does my browser support HTML5?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s