Browser-Based Programming


Web programming is not restricted to just server-based programming. The browser can execute programs as it loads the page that is, the programs can run on the user s computer, not on the Web server, as shown in Figure 1-4 on the following page.

Applets are an example of a type of program that was designed to run on the user s computer rather than on the server. Applets are small programs that are packaged up and sent with a page to the browser. From the perspective of the Web server, the applet is just more content on a page.

Flash animations are another form of browser-based Web programming. They work much like applets in that the code for the animation is sent along with the page to the browser. Yet another example of browser-based Web programming is Dynamic HTML (DHTML), which is a programming framework for Microsoft Internet Explorer specifically that gives programmers complete control of the page.

Does it matter that these types of Web programs run in the browser? Sure. If a program runs in the browser, it has access only to what s on the user s computer. For example, you can t create a program that runs in the browser and searches for Web pages using Google. The browser is running on your computer, and you don t have access to the big databases at Google.

click to expand
Figure 1-4: Server-based programming versus browser-based programming

Browser Compatibility

One problem with browser-based programs is that different types of browsers have varying support for programming. For example, older browsers support only limited client- side programming. Microsoft Internet Explorer supports a different kind of programming (DHTML) than Netscape browsers; in fact, DHTML is even supported differently on the Windows and Macintosh versions of Internet Explorer. So, you might create a page with lots of DHTML programming on it, but if the person viewing the page isn t using Internet Explorer, the page won t work. Users also configure their browsers differently, so some browsers might support Flash animations whereas others might not.

One of the beauties of server-based programming is that for most functions, it doesn t matter what type of browser the user has. All the programming work happens on the server. The end result of the server-based Web program is just HTML for the browser, no matter how many machinations the server code had to go through to construct that HTML.

To be clear, there s nothing wrong with browser-based programming. It s just different from server-based programming, and it s used for different reasons. Because it runs on the user s computer, browser-based programming is good for visual elements such as mouse-over effects and pop-up menus. Basically, it s good for anything that should respond immediately to the user. For example, if you want to create a game that s very interactive, you definitely want to do that by programming the browser.

The good news is that writing ASP.NET-based pages that run on the server puts no restrictions on what you can do with client programming in the browser choosing server-based or client-based programming isn t an either/or proposition. You can create pages that run on the Web server to get data, for example, but that also include browser code for menus or other effects.

This book will concentrate exclusively on server-based programming and on the types of applications you can create using server-based code. However, if you want to create those pop-up menus, mouse-over effects, and other cool visuals, I have to refer you to another book, HTML & XML for Beginners by Michael Morrison (Microsoft Press, 2001).




Microsoft ASP. NET Web Matrix Starter Kit
Microsoft ASP.NET Web Matrix Starter Kit (Bpg-Other)
ISBN: 0735618569
EAN: 2147483647
Year: 2003
Pages: 169
Authors: Mike Pope
BUY ON AMAZON

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net