Browser detection with php
This tutorial explains how to make a code only works in one separated browser, I think that’s useful to correct incompatibility of page style in some browsers.
In your page, put:
In your page, put:
Code:
Â- $user_agent = isset($_SERVER[‘HTTP_USER_AGENT’]) ? $_SERVER[‘HTTP_USER_AGENT’] : ”;
 - if(strpos($user_agent, ‘Opera’) !== false)
 - {
 -   echo ‘code for Opera’;
 - }
 - elseif(strpos($user_agent, ‘Gecko’) !== false)
 - {
 -   echo ‘code for Mozilla/Firefox’;
 - }
 - elseif(strpos($user_agent, ‘MSIE’) !== false)
 - {
 -   echo ‘code for IE’;
 - }
 - else
 - {
 -   echo ‘some other browser’;
 - }
Â
Â- ?>Â
Done, now modify the code to works how you want. This tutorial only explains how to show different codes for Internet Explorer, Mozilla browsers, Opera and show anything to all the other browsers.
Share this tutorial
Â