html - how to know the browser using php code -


this question has answer here:

i have site uses textfields. in firefox, use css. when open site in google chrome, got different design of site.

i think solution having diferent css file different browser. need know browser used following users. change link css.. example:

<link href='site_css/firefox.css' rel='stylesheet' type='text/css' /> 

then if user uses google chrome,

<link href='site_css/firefox.css' rel='stylesheet' type='text/css' /> 

<?php  // check browser visitor using   $user_agent = $_server['http_user_agent'];  // bit differentiates ie opera if(preg_match('/msie/i',$u_agent) && !preg_match('/opera/i',$u_agent))      {        print         'this internet explorer. (insert joke here)';             }      elseif(preg_match('/mozilla/i',$u_agent) && !preg_match('/compatible/', $useragent))      {        print         'this firefox.';     }  // let chrome recognized safari     elseif(preg_match('/webkit/i',$u_agent))      {        print         'this either chrome or safari.';     }      elseif(preg_match('/opera/i',$u_agent))      {        print         'this opera. live on edge, huh?';     }      elseif(preg_match('/netscape/i',$u_agent))      {        print         'this netscape, , need upgrade.';     }   ?> 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -