JS to determine whether the browser support html5_javascript skills

Source: Internet
Author: User

Now HTML5 seems to be getting popular, some front-end experts for compatibility considerations, will be added to the Web page to judge the client browser code, know whether the user browser support HTML5, the following share think I use 2 ways

Method One,

<script>  
function checkhHtml5 () {   
if (typeof (Worker)!== "undefined") {   alert ("Support HTML5");   }   else {   alert ("HTML5 not Supported");   } 
</script>

Method Two,

<canvas id= "Canvas" ></canvas>

<script>   if (!document.getelementbyid ("Canvas"). GetContext) {     alert ("Do not support HTML5");   }   else{  alert ("Support HTML5");  </script>

If there is a better way, please contact me! Thank you

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.