0

Can any one help meto detect browser supports html5 and css3 or not ? I have tried this code :

if(Modernizr.canvas){
        alert('Html 5 support');
    }
    else{
        alert('HTML 5 not supported');  
    }

But this always show "Html 5 supoort" while IE6 doesn't support HTML 5.

THanks, M

Amit Kumar
  • 3,384
  • 6
  • 25
  • 42

2 Answers2

0

Not sure about your problem without more detail.

Use below code to detect again:

function supportCanvas() {
    /* 
       maybe use code below for detail:
       var cvs = document.createElement('canvas');
       alert(typeof cvs.getContext); // if support, output "function"
    */
    return !!document.createElement('canvas').getContext;
}
creeper
  • 499
  • 2
  • 17
-1

you can check html5 support by checking localstorage feature

 if (Modernizr.localstorage) {
alert('localStorage is available!');
 // run localStorage code here...
 }
 else {
 // no native support for local storage
 alert('This Browser Doesn\'t Support Local Storage.');
 }
Pascal
  • 122
  • 5