How to check if a browser supports HTML5 and CSS3 functions using Ruby?

I need to make an if using Ruby, which checks if the browser supports the HTML5 client or not.

+4
source share
5 answers

Short version: you cannot and should not.

Long version. Perhaps if you are spoofing a user agent to determine if the user's browser supports HTML5 or not. But it will take considerable effort to get better. The best solution is to use something like Modernizr (http://www.modernizr.com/) to detect your function on the client side.

+9
source

You can read browser information based on the HTTP_USER_AGENT line, but, as mentioned above, and in many other places, it is also very easy to trick this information. On the server side, we only cared because it gave us a general idea that client browsers are used to access our sites.

An attempt to respond to the browser on the backend and present other content for several days has been tested by sites, but it fails because browsers trick other browsers but do not have the same errors.

As @Stephen Orr said, CSS is the best way to handle this. Sure, damn it, it's still error prone, but better than sniffing a browser signature. We used to criticize every release of IE because it violated previous fixes. Fortunately, it seems that things get better when manufacturers creep to standards.

+1
source

Possibly Feature Discovery in HTML5 to detect individual features from HTML5 as needed. However, there is no way to determine if the browser supports HTML5 as one big piece, since there is no “official” way to find out if the browser supports all HTML5 or only parts of it.

+1
source

Most functions can be detected (using JavaScript), but some views, such as the form date field, are a problem: http://united-coders.com/matthias-reuter/user-agent-sniffing-is-back

+1
source
 < [html5 element] id="somethingtobedazzledby"> Upgrade your browser </ [html5 element] > 
0
source

All Articles