MDN self-hosted library · e01.org

History: back() method

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

html
<button id="go-back">Go back!</button>
js
document.getElementById("go-back").addEventListener("click", () => {
  history.back();
});