Showing posts with label detecting browser using javascript. Show all posts
Showing posts with label detecting browser using javascript. Show all posts

Thursday, 30 June 2011

Detecting Google Chrome using JavaScript

You can detect Chrome by using the following bit of JavaScript:


var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;


The following string represents Chrome's full user agent:

User-agent header sent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30