
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
What is the role of the window.history object in JavaScript?
The window.history object is used to go back or to the next page of the web browser. It has the browser's history and comes with the following two methods −
- history.back − Go to previous URL
- history.next − Go to next URL
Example
You can try to run the following code to learn how to work with window.history object in JavaScript −
<!DOCTYPE html> <html> <body> <script> function backPage() { window.history.back() } function nextPage() { window.history.next() } </script> <input type="button" value="Previous URL" onclick="backPage()"> <input type="button" value="Next URL" onclick="nextPage()"> </body> </html>
- Related Articles
- What is the role of Navigator object in JavaScript?
- What is the role of Browser Object Model (BOM) in JavaScript?
- What is the role of clearTimeout() function in JavaScript?
- What is the role of throw statement in JavaScript?
- What is the role of pageXOffset property in JavaScript?
- What is the role of filter() method in JavaScript?
- What is the role of scrollY property in JavaScript?
- What is the role of scrollX property in JavaScript?
- What is the role of parseFloat() method in JavaScript?
- What is the role of parseInt() method in JavaScript?
- What is the role of deferred scripts in JavaScript?
- What is the role of exec method in JavaScript RegExp?
- What is the role of global RegExp property in JavaScript?
- What is the role of source RegExp property in JavaScript?
- What is the role of lastIndex RegExp property in JavaScript?

Advertisements