|
|
|
|
PHP-browserdetecting script
Home » PHP » Content Management
PHP-browserdetecting script
This tutorial explains how to identify IE4+ or NS4+ on a windows 32 bit platform (all else is "OtherBrowser") and include different html Web pages for different browser types using PHP.
A browserdetecting script for PHP that decides wich files that should be included,
As I started with my php-site I needed something that could identify what browser the visitor was using.
Why? Because I'm using three different types of navigation styles on my site, one that's IE4+ only, one for NS4+ and one for the rest. When you are using javascript, there's a lot of different browserdetectors to use, but I had difficulties finding one for php.
Finally I found one that got me started, it didn't work as I wanted so I modified it a lot. Here I'll present it and try to walk you through it.
What did I need to start modifying this?
Well, I started everything by making a simple javascript that I could run in different browsers, It writes out exactly what the different navigator objects contains, this way it's a lot easier to know what to test for.
Here is what your current browser contains:
The appname of the current browser is: Microsoft Internet Explorer
The appcodename of the current browser is: Mozilla
The appversion of the current browser is: 4.0 (compatible; MSIE 6.0; Windows NT 5.1)
The useragent of the current browser is: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
The appminorversion of the current browser is: ;SP2;
|
More Tutorials by this user
|
|
|
|
|
|
|
|
|