get_browser() for Browser Details

get_browser() for Browser Details

In the era of search engine optimization, many webmaster tools are available for use by webmasters to find out about different aspects of their domains and sites. One tool provided is ‘Browser Details’ which indicates your browser capabilities.

There are different browsers available in the market having different versions. These different versions of browsers are available with their inbuilt capabilities. Therefore, browser details tool is useful for determining browser capabilities the user has used.

In PHP, get_browser() function is widely used for finding out the browser capabilities. This is done by looking up the browser’s information in the browscap.ini file. The information returned by this function is an object which contain various data elements like browser name, version and also its compatibility with javascript, cookies, frames, css, vbscript, java-applets, activexcontrols, etc.

< ? $browser = get_browser(); ?>

In order for this to work, your browscap configuration setting in php.ini must point to the correct location of the browscap.ini(browser capabilities file) file on your system and if it is not set properly then gives warning like :

Warning: get_browser() [function.get-browser]: browscap ini directive not set.

To solve this problem, you have to give correct path of browscap.ini file in php.ini file like :

[browscap]
browscap = “/home/…/folder/browscap.ini”

The format of browscap.ini file is self-explanatory and thus get_browser() function is used for displaying browser details by reading thru browscap.ini.

Sharing

Leave your comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.