JS Coding Questions Logo
JS Coding Questions
#78💼 Interview💻 Code

How do you access history in javascript

Advertisement

728x90

The window.history object contains the browser's history. You can load previous and next URLs in the history using back() and next() methods.

javascript
1function goBack() {
2
3window.history.back();
4}
5
6function goForward() {
7
8window.history.forward();
9}

Note: You can also access history without window prefix.

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 79

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
78of476