How to detect browser using PHP Script?

This Comment will be submitted for moderation and will not be accessible to other users until it has been approved.


This tutorial explains on how to detect your browser from the php code.

Steps are as follows:

a. Download the script below:
http://techpatterns.com/downloads/scripts/browser_detection_php_ar.txt

b. Rename the text file browser_detection_php_ar.txt to browser_detection.php.

c. In your php code, include the above file and use the code below:


<?php
include "browser_detection.php";
echo ( 
browser_detection'browser_number' ) .'<br>'.
browser_detection'browser_working' ) .'<br>'.
browser_detection'os' ) .'<br>'.
browser_detection'os_number' ) );
?>

It Works!





Post Comment

  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.