I found this code to detect the browser via php:
<?php
$msie = strpos($_SERVER["HTTP_USER_AGENT"], 'MSIE') ? true : false;
$firefox = strpos($_SERVER["HTTP_USER_AGENT"], 'Firefox') ? true : false;
$safari = strpos($_SERVER["HTTP_USER_AGENT"], 'Safari') ? true : false;
$chrome = strpos($_SERVER["HTTP_USER_AGENT"], 'Chrome') ? true : false;
?>
<?php
//Firefox
if ($firefox) {
echo 'you are using Firefox!';
echo '<br />';
}
// Safari or Chrome. Both use the same engine - webkit
if ($safari || $chrome) {
echo 'you are using a webkit powered browser';
echo '<br />';
}
// IE
if ($msie) {
echo '<br>you are using Internet Explorer<br>';
echo '<br />';
}?>
But the code does not include the possible versions of IE. Did something like this:
// IE7
if ($msie7) {
echo '<br>you are using Internet Explorer 7<br>';
echo '<br />';
}
Could someone help me with this? Wanted to improve the code including support IE versions.