O'Reilly logo

Professional ASP.NET 3.5 AJAX by Matt Gibbs, Dan Wahlin, Bill Evjen, Dave Reed

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

3.1. Using JavaScript on the Client

The JavaScript language can be used independently of the browser. There are JavaScript interpreters for managing operating system components, interacting with COM objects, and automating server administration tasks. To use JavaScript in the browser, you should be aware of a few considerations.

First, you need to manage getting the script to the browser for a page effectively. As the amount of JavaScript you use grows, you will want to make use of the browser's ability to cache scripts for performance reasons. You also need to be aware of how the user's interaction with a page while background operations are performed affects the user's perception of the page's performance. In some conditions, you want your users to know that they are waiting for an action to be performed so they don't become frustrated, and in other cases, you want to ensure that the page is responsive while something happens transparently in the background. In addition, JavaScript resources can be embedded directly in a DLL and do not have to be deployed as text files on disk, as you might be accustomed to doing.

3.1.1. Getting JavaScript to the Browser

Before diving into the fundamentals of the language, you should understand how JavaScript code gets to the browser as part of a Web application. The HTML script tag is used to separate the script code from the markup, so the browser will be able to distinguish the difference. Listing 3-1 shows the two possible methods for including ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required