SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 132 | Next

Robin Pars, Laurence Moroney, and John Grieb

"Foundations of ASP.NET AJAX"

The Sys.Browser class makes the task of browser detection and targeting
a lot simpler than the traditional approach with JavaScript. Consider the following line of
script:
if (Sys.Browser.agent === Sys.Browser.Firefox)
// Write browser-specific logic for Firefox
As you can see, it??™s extremely easy to identify the browser type here with much less
code than it would take in raw JavaScript. There are four predefined browser types to
account for the four most popular browsers on the market:
* Sys.Browser.InternetExplorer
* Sys.Browser.Firefox
* Sys.Browser.Opera
* Sys.Browser.Safari
Identifying the browser version can just as easily be done with the version property
of the Sys.Browser class. Keep in mind that all methods of the Sys.Browser class are static
like and do not require instantiation.
Sys.StringBuilder
String concatenation is a relatively common task in JavaScript especially when you need
to dynamically inject HTML into a page via JavaScript. In such cases, plain old string concatenation
can fast lead to very messy code. The Sys.StringBuilder class is somewhat
similar to its .


Pages:
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144