Detecting webkit browser

I’m displaying animations on a blog post. I’m using flash on most browsers but want to use html 5 animation on webkit based browsers. Is there a simple php based test that I can apply to decide which browser is being used, specifically, is the viewer using using a webkit browser. Thanks

You can use this server var to determine the user agent (browser):

$_SERVER['HTTP_USER_AGENT']

Thanks :slight_smile:

When I look at this variable it give a few different browsers, for example when I view it in chrome I get

mozilla/5.0 (macintosh; intel mac os x 10_6_8) applewebkit/534.30 (khtml, like gecko) chrome/12.0.742.112 safari/534.30

How do I know which browser is being used?
thanks

If you do a quick check on the string and see if the word chrome is in there it should work:

if (eregi("chrome", $_SERVER['HTTP_USER_AGENT']) == true) {
your code here
}

DO NOT USE ereg! Its going the way of the dodo bird.
Use stripos instead. http://us2.php.net/manual/en/function.stripos.php