Reputation: 50728
Is it possible from the server in ASP.NET, whether web forms or MVC, to determine whether the current browser supports HTML 5, other than checking solely on browser type?
Upvotes: 2
Views: 739
Reputation: 54368
I don't think any browser completely supports HTML 5 and HTML 5 is a draft (as of this post). Perhaps it would be better to define the subset of features you wish to support.
ASP.Net does have a framework for managing browser capabilities, but maintaining that list will still probably be a somewhat manual process.
If there really is a good reason for doing so (and I'm not sure there is), you could create a simple test with JavaScript which examined the HTML 5 capabilities you cared about. This would require the page to evaluate the script before loading any content.
You could store the results of that test in a (small) cookie which would then be passed along with subsequent requests so the server would have an accurate idea of the browser's capabilities.
Realistically, it would probably be much better to just make some generalizations server side based on browser type/rendering engine, possibly using the browser capabilities framework built into ASP.Net to make things a little cleaner.
Upvotes: 4