Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
How can I check if a browser that supports HTML5 by using any programming/scripting language?

Thanks in advance!

Modification:

With the below given posts/answers, I found out what the best Browser is that supports HTML 5
Browser Scores: (this is in my computer)
Mozilla Firefox 3.6.13 = 155 and 04 bonus points
Opera 11.01 = 234 and 07 bonus points
Google Chrome = 282 and 13 bonus points
Safari = 228 and 07 bonus points

Can someone show me how to get or even just check if the browser can support some HTML 5.
I'd totally appreciate if someone can post a code.
Posted
Updated 2-Mar-11 21:28pm
v7
Comments
Manfred Rudolf Bihy 3-Mar-11 3:27am    
I found some code in a project on GIT, but you'll have to read that stuff yourself in order to extract the necessary bits: https://github.com/NielsLeenheer/html5test/blob/master/index.html

The above link is to the page that contains the javascript for the tests. Maybe you can extract some information from there.
hansoctantan 3-Mar-11 19:55pm    
tnx

This is sounds like a very tough job as none of the existing browsers fully support HTML5. There are ones doing better at supporting a subset of HTML5 than others. There is a check on this page (HTML5 Test[^]) that gives you an idea what checks to integrate, but this page doesn't claim completeness. One page shows how your browser is scoring and second one shows the scores of other browsers as a comparison.

Cheers!

Modification:

Here you'll find a "HTML5 Testpage" project on GIT. The index.html file is especially interesting: https://github.com/NielsLeenheer/html5test/blob/master/index.html[^]
 
Share this answer
 
v5
Comments
Sergey Alexandrovich Kryukov 3-Mar-11 3:11am    
That is correct :<
As this is not entirely your fault, I find it possible to vote 5. :-)
--SA
Manfred Rudolf Bihy 3-Mar-11 4:57am    
Thanks SA!
Dalek Dave 3-Mar-11 4:23am    
Good Call.
Manfred Rudolf Bihy 3-Mar-11 4:58am    
I appreciate it! :)
Hi,
The better solution is to use something like Modernizr (http://www.modernizr.com/) to do your feature detection on the client-side.Modernizr is an open source, MIT-licensed JavaScript library that detects support for many HTML5 & CSS3 features.
XML
If your browser does not support the canvas API, the Modernizr.canvas property will be false.
<script >

if (Modernizr.canvas) {
  // let&#39;s draw some shapes!
} else {
  // no native canvas support available :(
}</script >


Ref:http://diveintohtml5.info/detect.html[^]

Another solution if you are using JQuery:
Checking for support for the canvas element of HTML 5
var test_canvas = document.createElement("canvas") //try and create sample canvas element
var canvascheck=(test_canvas.getContext)? true : false //check if object supports getContext() method, a method of the canvas element
alert(canvascheck) //alerts true if browser supports canvas element

Ref:http://www.javascriptkit.com/javatutors/createelementcheck.shtml[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900