YouTip LogoYouTip

Js Window History

```html\n\nJavaScript Window History \n\n/* Styles remain exactly the same, omitted for brevity */\n\n
\n\n\n\n\n\n\n
\n

JavaScript Window History

\n
\n

The window.history object contains the browser's history.

\n
\n\n

Window History

\n

The window.history object can be written without the window prefix.

\n

To protect user privacy, JavaScript has limited access to this object.

\n

Some methods:

\n
    \n
  • history.back() - same as clicking the back button in the browser
  • \n
  • history.forward() - same as clicking the forward button in the browser
  • \n
\n\n

Window History Back

\n

The history.back() method loads the previous URL in the history list.

\n

This is the same as clicking the back button in the browser.

\n

Example:

\n
<html>\n<head>\n<script>\nfunction goBack() {\n  window.history.back()\n}\n</script>\n</head>\n<body>\n\n<input type="button" value="Back" onclick="goBack()">\n\n</body>\n</html>
\n\n

Window History Forward

\n

The history.forward() method loads the next URL in the history list.

\n

This is the same as clicking the forward button in the browser.

\n

Example:

\n
<html>\n<head>\n<script>\nfunction goForward() {\n  window.history.forward()\n}\n</script>\n</head>\n<body>\n\n<input type="button" value="Forward" onclick="goForward()">\n\n</body>\n</html>
\n\n\n
\n\n
\n

Vue Tutorial

\n\n\n

Bootstrap

\n\n\n

Machine Learning

\n\n
\n\n\n
\n\n```
← Js Window NavigatorJs Window Location β†’