How to Use JavaScript Browser Objects to Manage the Application Environment

Part of the HTML5 Programming with JavaScript For Dummies Cheat Sheet

JavaScript browser objects make it possible to discover and change the application environment. By knowing where the user has gone, where the user is now, and where you can take the user, you can effectively control the application flow. Of course, it’s important to know what size screen the user has so that you can present data in a manner that reflects the physicality of the user’s device.

The following table details some of the more interesting JavaScript browser options.

Object Description
history Provides the means for examining and moving between URLs stored in the browser’s history. You can see a complete list of the methods and properties associated with this object at www.w3schools.com/jsref/obj_history.asp.
location Contains information about the current URL. This object also provides the means to perform tasks such as loading a new page or reloading the current page. You can see a complete list of the methods and properties associated with this object at www.w3schools.com/jsref/obj_location.asp.
navigator Contains information about the current browser. For example, you can determine the browser type and whether the browser has cookies enabled. You can see a complete list of the methods and properties associated with this object at www.w3schools.com/jsref/obj_navigator.asp.
screen Specifies the physical characteristics of the device used to display the page, including page height, width, and color depth. You can see a complete list of the methods and properties associated with this object at www.w3schools.com/jsref/obj_screen.asp.
window Provides access to the browser’s window so that you can perform tasks such as displaying message boxes. When working with pages that contain frames, the browser creates a window for the entire HTML document and another window for each frame. You can see a complete list of the methods and properties associated with this object at www.w3schools.com/jsref/obj_window.asp.
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus

SERIES
HTML5 Programming with JavaScript For Dummies Cheat Sheet

Advertisement

Inside Dummies.com