Jan 31 2007

Ajax for ASP.NET Browser detection

Posted by admin under ASP.NET AJAX formally Atlas

Just a small tip (didn't dind it in the client side reference docs ): by using Sys.Browser.agent we can see which browser the visitor is using -- and therefore be able to adjust the Javascript code thereafter.

Example:



    if(Sys.Browser.agent == Sys.Browser.InternetExplorer)
    {
       //do some special here for IE 
    }

There are four predefined values

Sys.Browser.InternetExplorer

Sys.Browser.Firefox

Sys.Browser.Opera

Sys.Browser.Safari

which we can test against.