PHP: Detecting Google Chrome Browser
Posted on October 6, 2008, Filled under PHP,
Bookmark it
This is a short snippet useful to detect if the visitor uses Google Chrome Browser.
<?php
function is_chrome()
{
return(eregi("chrome", $_SERVER['HTTP_USER_AGENT']));
}
if(is_chrome())
{
// code for Chrome Browser here
echo 'You are using Google Chrome Browser.';
}
?>
Do you wish to receive the latest updates as soon as they are posted? Get our RSS Feed or Subscribe to the Newsletter!
- October 6, 2008
- article by Gabriel C.
- 6 comments
Sponsors
Related Posts
-
Create, Customize and Send Newsletters: MeeNewsat August 3, 2009
-
A PHP Contact Form with JavaScript Real Time Validationat April 30, 2009 with 17 comments
-
Insert Google AdSense Ads between your WordPress Blog Postsat July 13, 2009 with 19 comments
-
A tableless 2 (fluid) columns layoutat September 10, 2008

6 Replies to "PHP: Detecting Google Chrome Browser"
December 8, 2008 at 9:25 PM
[...] Probado en BitRepository [...]
June 6, 2009 at 9:28 PM
I dont fully understand the need for this?
July 12, 2009 at 3:13 AM
This code is great if you wish to display one set of output for Chrome, and another for (say) Firefox or Internet Explorer.
Thanks for providing this code… it really saved me today!
July 12, 2009 at 1:31 PM
@Eric Wood,
Thanks Eric, now i understand.
October 16, 2009 at 4:37 AM
[...] [...]
January 26, 2010 at 3:43 AM
Thx! This was just what i needed, and very simple to.
I use it because chrome of some reason wants a differen charset, than IE, and FF in some cases. (Too display special characters, when using AJAX, PHP, HTML, and CSS).
Thx alot!