Page 1 of 1

How do I tell if the Browser supports PHP 5?

Posted: Sun Nov 07, 2010 8:22 pm
by jcobban
I do not understand why there is apparently no agreed upon way to determine if the browser that you are generating code for is HTML5 compatible. I asked this in another forum and got back a comment that HTML5 is supposed to be backwards compatible, which is ridiculous. Even if I limit my HTML5 functionality to tags and attributes that are supported by HTML 4.1 the content of the page is still different and may be misunderstood by back-level browsers. And if I do limit my HTML to tags and attributes that are supported by HTML 4.1 what is the point? I might as well leave the page in HTML 4.1. But I cannot find anything anywhere on the web about how to tell from PHP whether it is safe to send HTML5 to the browser. The only useful comment I have received is that I can use the non-standard browser-side comment tags for identifying the browser support to enclose the HTML5-only code.

The "dive into HTML5" page tells me how Javascript can tell whether the browser it is running on supports various features of HTML5, but I have to get the web page to the browser before the Javascript can run.

Re: How do I tell if the Browser supports PHP 5?

Posted: Sun Nov 07, 2010 8:34 pm
by s.dot
I have no idea about this topic..
But if javascript can detect it, why not detect it and do a javascript redirect to the appropriate version of the page.

Re: How do I tell if the Browser supports PHP 5?

Posted: Sun Nov 07, 2010 9:11 pm
by requinix
With PHP you'd have to resort to browser detection.

A lot of HTML 5 is backwards compatible. Most of the non-form additions have semantic meaning, not presentational. What HTML 5 stuff are you trying to use?

Re: How do I tell if the Browser supports PHP 5?

Posted: Mon Nov 08, 2010 8:55 am
by Eric!
It seems that the javascript way of testing for HTML5 requires testing memory space for allowed HTML5 DOM options. You could use a AJAX style page that could test the browser, then pass the right parameters to a PHP page and render the appropriate HTML. However HTML5 should be compatible with older browsers because the HTML5 features of the object are ignored.

If you want to try it all in PHP, try the $_SERVER['HTTP_USER_AGENT'] and process agents you know to be HTML5 compatible or also try the get_browser function.... The browscap.ini file that it loads will slow down your page some.

Also there is phpSniff which doesn't quite meet your needs, it might be helpful in understanding the client. http://phpsniff.sourceforge.net/

Re: How do I tell if the Browser supports PHP 5?

Posted: Mon Nov 08, 2010 10:03 am
by pickle
This is essentially a duplicate of your other thread.

Locking.