|
May 11
2011
|
Detect Browser PHPPosted by bohemia in Untagged |
|
Finding out what version your browser is with php is required if you want to make custom conditions for a specific browser or various browser versions.
To find the version,
1) //Make a variable for the browser which is being used.
$browser = $_SERVER["HTTP_USER_AGENT"];
2) // Print the browser to the page to display the required information.
echo $browser;
3) //Set a condition for the browser.
i.e. if ($browser == 'Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1' || $browser == 'Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.0' ) {
$qty = 1;
}
1) //Make a variable for the browser which is being used.
$browser = $_SERVER["HTTP_USER_AGENT"];
2) // Print the browser to the page to display the required information.
echo $browser;
3) //Set a condition for the browser.
i.e. if ($browser == 'Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1' || $browser == 'Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.0' ) {
$qty = 1;
}




