Examples of using JavaScript to access and manipulate the Browser objects.
Window Object
Open a new window when clicking on a button Open a new window and control its appearance Blur and Focus a new window Close the new window Checks whether the new window has been closed or not Write some text to the source (parent) window Move the new window relative to its current position Move the new window to the specified position Print the current page Resize a window by the specified pixels Resize a window to a specified size Scroll the content by the specified number of pixels Scroll the content to a specified position
Window explained
Screen Object
The visitor's screen: Width The visitor's screen: Height The visitor's screen: Available Width The visitor's screen: Available Height The visitor's screen: Color Depth The visitor's screen: Pixel Depth
Screen explained
Location Object
Return the hostname and port of the current URL Return the entire URL of the current page Return the path name of the current URL Return the protocol portion of the current URL Load a new document Replace the current document Break out of a frame
Location explained
History Object
Display the number of URLs in the history list Create a back button on a page Create a forward button on a page Load a specific URL from the history list
History explained
Navigator Object
Is cookies enabled in the visitor's browser? What is the name of the visitor's browser? What is the engine name of the visitor's browser? What is the version information of the visitor's browser? What is user agent information of the visitor's browser? What is the platform of the visitor's browser? What is the language of the visitor's browser? Is Java enabled in the visitor's browser?
Navigator explained
Popup Boxes
Display an alert box Demonstrate line breaks in an alert box Display a confirm box Display a prompt box
Popup explained
Timing
Simple timing Another simple timing Timing event in an infinite loop Timing event in an infinite loop - with a Stop button A clock created with a timing event Set and stop a timer with setInterval() and clearInterval()
Timing explained
Cookies
Create a welcome cookie
Cookies explained