Possible Duplicate:
Any php code to detect the browser with version and operating system?
how to detect internet explorer and firefox using PHP?
I need to add specific html to non firefox browsers, therefore I need to first detect if user is using firefox or not, i have to do this using php. Something along these line?
<!--[if Firefox]>
Mozilla only HTML here!
<![endif]-->
Any one? Thanks
Use this snippet of code to retrieve the kind of browser:
if (isset($_SERVER['HTTP_USER_AGENT'])) {
$agent = $_SERVER['HTTP_USER_AGENT'];
}
Then, compare against the user agent string.
For example, to detect "Firefox" you could do:
if (strlen(strstr($agent, 'Firefox')) > 0) {
$browser = 'firefox';
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With