Forum Moderators: coopster

Message Too Old, No Replies

Determing browser DOM capability server-side

using php instead of javascript

         

HarryM

1:24 pm on Apr 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I currently use phpSniff to identify the user's browser, but this is really over-the-top for what I need to do. Essentially I serve a simple table-based template for IE4 and NS4 browsers, whereas everyone else gets the full monty.

Using javascript it would be possible to identify the older browsers by testing for getElementById. Is there any way of doing something similar with php server-side?

I have searched the usual php sites with no success, but as I'm not a php expert I may have overlooked something.

dreamcatcher

1:43 pm on Apr 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



$_SERVER['HTTP_USER_AGENT'] will get you the browser info.

From that would need to compare certain parts of the string to identify the browser.

dc

HarryM

7:24 pm on Apr 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks, but I'm trying to avoid identifying the browser (which I can do with phpSniff anyway). What I want to do is identify the browser's capabilities re the DOM.

GetElementById is a good test as anything that passes can handle divs and floats which is the only problem I have with the older browsers.