HomeJavaScript Controlling Browser Properties with JavaScript
Controlling Browser Properties with JavaScript
Maybe you know how to make Web pages dance to your tune with JavaScript - but how about making the browser do the same? This tutorial focuses on the important browser objects (including the Window, Location and History objects) that are controllable via JavaScript, showing you how to manipulate and use them in your scripts.
In your travels across the Web, you've already seen how client-side scripting can turn even the most static site into an interactive, dynamic experience. Client-side scripting (usually in its most popular avatar, JavaScript) can zoom menus in and out, morph images when a mouse comes near them, and warn you when you enter invalid values into a form.
But JavaScript can do a lot more than this. In addition to manipulating Web pages on an HTTP client, it can also be used to manipulate attributes of the client itself. With JavaScript, you can control the size of the client window, the URL which it's requesting, the appearance of its toolbars, and many other properties. This control is made available to you, the developer, through a variety of different objects, all of which are good to know if you're in the business of writing client-side scripts for a Web site or application.
That's where this tutorial comes in. Over the next few pages, I will be demonstrating some of the JavaScript objects that allow you to exert control over the browser window, its properties and its contents. Some of this may already be familiar to you, especially if you've been working with JavaScript for a while. Newbies, on the other hand, should find plenty to entertain themselves with. So come on in, and let's get going!