JavaScript code used to determine whether the browser supports html5_javascript

Source: Internet
Author: User
This article mainly introduces how to use js to determine whether a browser supports html5. If you need it, you can refer to it. HTML5 seems to be getting popular now. For compatibility considerations, some front-end experts, the code used to judge the browser on the client is added to the webpage to check whether the browser supports HTML5. Below are two methods I want to use.

Method 1,

Script function checkhHtml5 () {if (typeof (Worker )! = "Undefined") {alert ("HTML5 supported");} else {alert ("HTML5 not supported") ;}} script

Method 2,

 Script if (! Document. getElementById ("Canvas"). getContext) {alert ("html5 not supported");} else {alert ("html5 supported");} script

If you have a better method, please contact me! Thank you.

Related Article

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: 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.