08.01.2015 Views

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 11 ■ <strong>AJAX</strong> APPLICATIONS AND EMPOWERING THE WEB USER EXPERIENCE 255<br />

user actions, providing a dynamic environment that reduces postbacks <strong>and</strong> page<br />

refreshes.<br />

Another increment to this came with Microsoft’s Remote Scripting technology, which<br />

took this to the next level, providing a browser plug-in that could communicate with a<br />

server over sockets <strong>and</strong> expose the data that it received to JavaScript. This plug-in was a<br />

Java applet <strong>and</strong> was released with Internet Explorer 4.<br />

After this, an ActiveX control that provided a dependency-free plug-in was produced<br />

by Microsoft. This object, called XMLHttpRequest, came with Internet Explorer 5. The first<br />

major application to use this functionality was the web-based version of Microsoft’s popular<br />

Outlook e-mail program, Outlook <strong>Web</strong> Access. The e-mail scenario is perfect for<br />

asynchronous web page updates—when a new e-mail comes in, you would like it to<br />

appear in your inbox without a complete page refresh, just like it does in your desktop<br />

application.<br />

This XMLHttpRequest ActiveX control is the heart of Ajax. Oddly enough, although it<br />

was released to the wild in 2000, it didn’t really pick up until nearly five years later.<br />

There are a number of possible reasons for this, including browser support—initially,<br />

XMLHttpRequest was Internet Explorer–only. Another reason was likely the availability of<br />

broadb<strong>and</strong>. Increasing broadb<strong>and</strong> penetration over that five-year period lead to a greater<br />

dem<strong>and</strong> for richer web applications <strong>and</strong> more incentive for web sites to provide richer<br />

experiences.<br />

The first Ajax application that I used was Google Maps—with mapping being the perfect<br />

sweet spot for consumer-oriented rich applications. Consider your workflow when<br />

using a mapping application—you enter an address <strong>and</strong> receive a map showing the area<br />

around your address. You then likely want to inspect the area around that address, for<br />

example, to plot routes to that address. Before Ajax was used, you would pan around<br />

the map using North, South, East, <strong>and</strong> West buttons. The Ajax implementation used<br />

XMLHttpRequest to download the surrounding areas of the map in the background while<br />

you were inspecting the map. You would then drag the mouse around the map, <strong>and</strong> they<br />

would appear. Of course, if you dragged quickly, the tiles may not have been in place yet,<br />

<strong>and</strong> you would get a blank map while they downloaded—but the experience was still<br />

vastly superior to full page refreshes.<br />

The improvement in the user experience <strong>and</strong> the reduced amount of b<strong>and</strong>width that<br />

needed to be served to provide it created an irresistible new design pattern for web sites<br />

<strong>and</strong> experiences, <strong>and</strong> it wasn’t long before use of XMLHttpRequest became commonplace.<br />

At the same time, the concept of <strong>Web</strong> 2.0 was emerging. This concept, invented by<br />

Tim O’Reilly, described the next phase of the <strong>Web</strong>, built around services that allowed<br />

users, not just web developers, to be contributors of information. Effective collaboration<br />

from novice users requires an enhanced experience, <strong>and</strong> Ajax was there to provide it. As<br />

such, in developer terms, Ajax is pretty synonymous with <strong>Web</strong> 2.0. In the next section,<br />

we’ll take a look at getting started with Ajax programming <strong>and</strong> some of the neat things<br />

that you can do with it!

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!