Scripts — Simple PHP Browser Detection
This page has the 2 simple versions of our PHP browser detection scripts. The first, array based one is good if your requirements are basic but you still want the power of the main script, without the bloat and clutter. The second is a very simple one, more for beginners who don't want to learn how to do more complex programming yet. It also works fine, but is very simple and basic. The full version also detects most spiders, and an assortment of uncommon browsers and other user agents. They are being used in one form or another on our sites.
The simple versions detect Mozilla, IE, Safari, Konqueror, and Opera browser versions. It's easy to add more browsers to either the simple array based or the if clause one. The 'if' one is the very simplest, in case you don't understand how to deal with arrays, but it pays to learn.
Your Computer Box
Download: 'Your Computer' Box Script
Current Version: 1.3.4
File Last Modified: February 16, 2014. 18:02:39 pm
PHP Language Detection
Your Computer
Operating System:
Current Browser / UA:
HTML Support
JavaScript
PHP Browser Detection
About the Simple PHP Browser Detection Scripts
All our php browser detection scripts have been thoroughly tested, although of course no script is ever perfect, so they will be modified as time goes by. There is a 'last modified by' date scripted in next to each download so you can see if it has changed from the version you have. Please post any bugs or problems with the detection script in our web programming forum. If you do find something wrong with a script, we'll get it fixed and post an updated version as soon as we can get to it.
The full featured PHP browser detection script also include a decent OS detection, that is currently being expanded. It currently identify most Windows, Mac OS X, Linux, and Unix, as well as an assortment of more obscure OS's and http utility programs.
Please Link to our Site
It would really help us out, and help other people find this information, if you could add a link to our site in exchange for these scripts. Thanks.
<a href="http://techpatterns.com/downloads/php_browser_detection.php"> PHP Browser Detection</a>
Simplified PHP Browser Detection Script
Download: Simplified PHP Browser Detection Script
Current Version: 1.1.9
File Last Modified: September 30, 2009. 15:37:42 pm
This is a simplified version of the full featured browser detection script. This simpler version returns only two things, the browser name or the browser number, or an array containing these two values, but uses more or less the same logic as the above one. Use this if checking for super precise browser versions is not that important, but you still like the flexibility of using arrays and return values.
Example: <?php // this would be a simple ns4 test, say to protect //some page code that will not work in Netscape 4x if ( browser_detection('browser') == 'ns4' ) { execute some code; } else { execute some other code; } ?>
Simple Conditional (if) Based PHP Browser Detection Script
Download: Simple 'if' clause based PHP Browser Detection Script
Current Version: 2.0.2
File Last Modified: June 29, 2007. 14:54:33 pm
Simply cut and paste this browser detection script into your PHP code. This is the simple 'if' clause version of the browser detector. We also have a complex version, above, that is based on arrays and loops. This script uses if clauses to check for browser versions. It checks these agains the navigatorUserAgent() strings, then packs browser variables with the proper information.
The main advantages of this browser detection script, like the above one, is that it will not be fooled by Opera or Safari, no matter how Opera is set to identify itself, since the first thing tested for is Opera, and if it's Opera, that's the last thing tested for as well. It can be used to deliver browser specific stylesheets to the page depending on what browser is requesting the page. Since this is run on the server side, it doesn't require client side Javascripting to be enabled to function.
This code is a simpler version of what we use in case you are not comfortable with arrays and loops, if you need to set browser CSS and other coding particulars.
Currently this script identifies the following specific browsers: Opera, Internet Explorer 4, Internet Explorer, Mozilla/Netscape Gecko based browsers, Netscape 4.x, Konqueror, Safari It is easy to add more browsers if required.
Manual Downloads
If for some reason the above download links didn't work, you can download these here:
- Full Featured Javascript Browser detection
- Simple Javascript Browser detection
- PHP Browser detection (full featured)
- PHP Browser detection (simplified version of the above)
- PHP Browser detection (if conditional)
- 'Your Computer Information'
- PHP Language Detection