JavaScript Browser ObjectExamples
Use JavaScript to access and control browser object examples.
Window Object
- Pop up an alert box
- Pop up an alert box with line breaks
- Pop up a confirmation box and remind visitors what they clicked
- Pop up a prompt box
- Open a new window when clicking a button
- Open a new window and control its appearance
- Open multiple new windows
- Ensure the new window does not get focus
- Ensure the new window gets focus
- Close the new window
- Check whether the new window has been closed
- Return the name of the new window
- Transfer some text to the source (parent) window
- Move the new window relative to its current position
- Move the new window to a specified position
- Print the current page
- Specify the window size in pixels
- Specify the window size
- Scroll content by a specified number of pixels
- Scroll to the specified content
- A simple clock
- Use setTimeout() and clearTimeout() to set and stop a timer
- Use setInterval() and clearInterval() to set and stop a timer
- More Window object examples are in ourJavaScript Reference Manual.
Navigator Object
- Details of the visitor's browser
- More Navigator object examples are in ourJavaScript Reference Manual.
Screen Object
- Details of the visitor's screen
- More Screen object examples are in ourJavaScript Reference Manual.
History Object
- Return a URL history list
- Create a back button
- Create a forward button
- Go to the specified URL from the URL history list
- More History object examples are in ourJavaScript Reference Manual.
Location Object
- Return the hostname and port number of the current URL
- Return the entire URL of the current page
- Return the pathname of the current URL
- Return the protocol part of the current URL
- Load a new document
- Reload the current document
- Replace the current document
- Break out of frames
- More Location object examples are in ourJavaScript Reference Manual.