The negative side of having a new (and promisingly become popular) browser, no matter how good it can be, is you’ll have to test your web apps with it among many others.
Probably, the first step is to detect the browser from JavaScript code by parsing browser’s user agent, and here is what of Google Chrome.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13
I guess old JavaScript codes can mistakenly tell it Safari like when running the code snippet below using JQuery’s browser utility.
1 2 3 4 | $.each($.browser, function(i, val) { $("<div>" + i + " : <span>" + val + "</span></div>") .appendTo(document.body); }); |

It may be no problem until you find something wrong when your apps running on Chrome only. So, here is the code line to detect Chrome generally:
1 | var is_chrome = /chrome/.test( navigator.userAgent.toLowerCase() ); |
We’ll have to change the JQuery browser utility to support Chrome detection as follows:
1 2 3 4 5 6 7 8 9 10 11 | var userAgent = navigator.userAgent.toLowerCase(); // Figure out what browser is being used jQuery.browser = { version: (userAgent.match( /.+(?:rv|it|ra|ie|me)[\/: ]([\d.]+)/ ) || [])[1], chrome: /chrome/.test( userAgent ), safari: /webkit/.test( userAgent ) && !/chrome/.test( userAgent ), opera: /opera/.test( userAgent ), msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ) }; |
Now, correct result shows on test screen:

Just one notice: Current version of JQuery (1.2.6) is treating Chrome as if it was Safari and basically no serious problem has been found yet. Modifying browser detection can cause the lib render pages/elements incorrectly for it has no knowledge of Chrome’s rendering engine. To keep compatibility, you can change line 7 back to:
7 | safari: /webkit/.test( userAgent ), |
But in this case the browser will be detected as both Chrome and Safari — not nice solution, I accept.
Anyway, it’s very likely that JQuery and other JavaScript frameworks will include Chrome to browser list for detection in next versions.
Related Reading:
- Web Geek's Guide to Google Chrome
MAKE THE MOST OF THE WORLD’S HOTTEST NEW BROWSER, GOOGLE CHROME! Finally, there’s a web browser... Read More »
- Are You Prepared to Pay for Product "Snow Days"? / Poor Planning Is Hampering the Feds As the Digital TV Deadline Approaches / Apple Makes Enterprise Inroads with iWork.com, MacBook Pro / Google's Chrome Browser Will Challenge Microsoft's IE, Firefox (eWeek, Volume 26, Number 2, January 19, 2009)
- Using Google Chrome OS





I found that using jquery.corners plugin has caused problems on Chrome, IE7 and Opera – so having a way to detect if we have Safari or Chrome is good times!
var kde=function(){
if (typeof navigator.vendor != “undefined” && navigator.vendor == “KDE” && typeof window.sidebar != “undefined”){return true;}
else{return false;};
}();
How about KDE 3.5 or higher detection. This browser behave so diferently (at least in my script) that it also need to be detected ?
You can also use this JavaScript library to detect any browser including chrome. Not only this, you can trim a string, detect mouse positions etc
http://rochakchauhan.com/blog/2008/10/11/rochakjs-javascript-class-of-common-functions/