0

I want the code (C# / JavaScript) to detect which mobile browsers are support HTML5. I have the code to detect the HTML5(canvas) compatibility for desktop browsers. But this code is not working for mobile browsers.

if (!!document.createElement('canvas').getContext) {
  this browser supports HTML5(canvas)
} else {
    not supports HTML5...
}
1
  • 2
    Nothing supports "HTML 5", lots of things support "features that are first defined in HTML 5". Do proper feature detection, don't assume that because canvas is supported then so will everything else you want to use from HTML 5. Commented Mar 28, 2011 at 8:46

2 Answers 2

3

You could also use the famous Modernizr.

Sign up to request clarification or add additional context in comments.

3 Comments

He wants to detect via C# on the server side, modernizer is great for client side but unless i'm an idiot there isn't a server side .NET module
@Scott, the topic starts with "I want the code (C# / JavaScript)...", so I showed an option in JavaScript. Thnx.
Ah my mistake I thought he only wanted c#, apologies.
2

Use this library http://51degrees.mobi/ it will return you a list of browser capabilities based upon the client and is based from an updated database. We use at work and it's awesome

2 Comments

Although it says to add it in the web.config for the whole project to do a simple detection you can host the example project at a virtual directory or another site. The example project has a web service MobileDevice.asmx that you can pass the User Agent and it will return a list of browser capabilities. It's about the best library for mobile you can get
Good link that, it will probably prove useful in the future.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.