Java Reference
In-Depth Information
Programming the Browser
What You Will learn in this Chapter:
➤
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
Wrox.Com Code doWnloads for this Chapter
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
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, there is a
window
object corresponding to the window of the browser. You have already been using two methods