wxpsadd Posted December 11, 2008 Share Posted December 11, 2008 good day guys, can someone teach me on how to determine a internet browser in php? i want to include some codes like this below if (browser==IE){ $css = "default"; else{ $css = "mycss"; } } i hope you get my point, thanks i advance Link to comment https://forums.phpfreaks.com/topic/136446-solved-php-choose-browser/ Share on other sites More sharing options...
phpSensei Posted December 11, 2008 Share Posted December 11, 2008 <?php if ( strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') ) { if ( strpos($_SERVER['HTTP_USER_AGENT'], 'Netscape') ) { $browser = 'Netscape (Gecko/Netscape)'; } else if ( strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') ) { $browser = 'Mozilla Firefox (Gecko/Firefox)'; } else { $browser = 'Mozilla (Gecko/Mozilla)'; } } else if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ) { if ( strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') ) { $browser = 'Opera (MSIE/Opera/Compatible)'; } else { $browser = 'Internet Explorer (MSIE/Compatible)'; } } else { $browser = 'Others browsers'; } echo $browser; ?> Link to comment https://forums.phpfreaks.com/topic/136446-solved-php-choose-browser/#findComment-712160 Share on other sites More sharing options...
wxpsadd Posted December 11, 2008 Author Share Posted December 11, 2008 wow thanks a lot its a great help! Link to comment https://forums.phpfreaks.com/topic/136446-solved-php-choose-browser/#findComment-712164 Share on other sites More sharing options...
phpSensei Posted December 11, 2008 Share Posted December 11, 2008 wow thanks a lot its a great help! Np, mark as solved please. Link to comment https://forums.phpfreaks.com/topic/136446-solved-php-choose-browser/#findComment-712165 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.