8Programming the Browser


  • Working with the browser’s native window object
  • Sending the browser to a URL
  • Manipulating images after they are loaded in the page
  • Retrieving the browser’s current geographical position
  • Detecting the user’s browser


You can find the wrox.com code downloads for this chapter at http://www.wiley.com/go/BeginningJavaScript5E on the Download Code tab. You can also view all of the examples and related files at http://beginningjs.com.

Over the past few chapters, you’ve examined the core JavaScript language. You’ve seen how to work with variables and data, perform operations on that data, make decisions in your code, loop repeatedly over the same section of code, and even how to write your own functions. You moved on to learn how JavaScript is an object-based language, and you saw how to work with the native JavaScript objects. However, you are not interested only in the language itself; you want to find out how to write scripts for the web browser. Using this ability, you can start to create more impressive web pages.

Not only is JavaScript object-based, but the browser is also made up of objects. When JavaScript is running in the browser, you can access the browser’s objects in exactly the same way that you used JavaScript’s native objects. But what kinds of objects does the browser provide?

The browser makes available a remarkable number of objects. For example, ...

Get Beginning JavaScript, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.