Detect Google Chrome in ASP.NET AJAX

Google launched a new fast browser recently (currently in beta) – Chrome. Getting in short, with ASP.NET we do have some functionality for detecting browsers using the Sys.Browser class.

Extend the prototype as follows,

//Google chrome check
Sys.Browser.Chrome = {};
if (navigator.userAgent.indexOf(' Chrome/') > -1) {
    Sys.Browser.agent = Sys.Browser.Chrome;
    Sys.Browser.version = parseFloat(navigator.userAgent.match(/ Chrome\/(\d+\.\d+)/)[1]); = 'Chrome';
    Sys.Browser.hasDebuggerStatement = true;
Once you have this included in your script file and loaded inside the page, you can check it out as follows,
if(Sys.Browser.agent == Sys.Browser.Chrome){
//Write code for Chrome specific browser
Hope this helps!!

2 thoughts on “Detect Google Chrome in ASP.NET AJAX

  1. Balaji says:

    Thats a great job…….

  2. coffee says:

    it will be interesting to see if Chrome can get as much market share as Firefox; for now they seem to have leveled off…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: