history.back() — moving backward in session history
history.back() requests traversal one entry backward in browser session history. It behaves like history.go(-1); without a previous entry, it changes nothing.
CKTIS / JavaScript
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
history.back() requests traversal one entry backward in browser session history. It behaves like history.go(-1); without a previous entry, it changes nothing.
history.forward() moves one entry forward through browser session history. It behaves like history.go(1); without a next entry, it changes nothing.
history.go(delta) uses an offset measured in session history entries. Web IDL first converts a supplied argument to a signed 32-bit integer (long). A negative result requests backward traversal, a positive result requests forward traversal, and a zero result or an omitted argument reloads the page. Traversal is asynchronous.
history.pushState() normally adds a session history entry, stores state, and optionally changes the URL without loading a new document. Updating the interface remains your responsibility.
history.replaceState updates the state and optionally the URL of the current history entry without reloading the page. It does not add an entry, so it creates no additional Back-button step.
HTMLAnchorElement represents a hyperlink in the browser DOM. Its href property specifies the resource address, while target selects the browsing context in which to open it. Learn how the href property differs from the attribute and what _blank means.
HTMLButtonElement.disabled is a boolean property reflecting the presence of a button's disabled attribute. It lets you disable a button or remove its own disabled attribute, but does not describe every reason the control may be disabled.
The read-only HTMLButtonElement.form property returns the HTMLFormElement associated with a button, or null. It identifies the actual form rather than the text value of the form attribute.
HTMLButtonElement.type reads a button's effective type and writes its type attribute. It distinguishes submit, reset, and button; a missing or invalid value does not always mean submit.
HTMLCanvasElement provides a browser drawing surface. Learn how to use getContext(), width, and height. With a 2D context, assigning either dimension clears the drawing and resets context state, even when the value does not change.
HTMLCollection.length returns the current number of elements in a DOM collection. It is read-only, and its value updates automatically when the membership of the live collection changes.
Learn the seven HTML drag events, how they are divided between source and target, and when DataTransfer is readable or writable. Understand why dragover needs preventDefault() and why dragend does not prove that a drop succeeded.
HTMLElement.click triggers a synthetic click on an HTML element. It is neither a physical click nor a source of user activation.
HTMLElement.dataset exposes an element's data-* attributes as a DOMStringMap. It lets you read, write, and delete string data, mapping names such as data-user-id to userId.
The focus() method moves focus to an element that can receive it. Learn how focus differs from clicking, how scrolling and focus indication options work, and how to check the result.
HTMLElement.hidden reflects the hidden attribute: it returns false, true, or "until-found". It is not a visibility test.
Learn hidden, draggable, tabIndex, click(), offsetHeight and title on HTMLElement. Distinguish writable properties, an activation method and a read-only measurement while accounting for keyboard navigation and CSS layout.
HTMLElement.offsetWidth reads an element's integer width in CSS pixels, including padding and borders but excluding margins. It ignores CSS transforms.
HTMLElement.style exposes a mutable inline CSS declaration object, not the result of the cascade.
The tabIndex property reflects the tabindex attribute and influences focusability and keyboard navigation order.
The form.checkValidity() method checks constraints on controls associated with a form and returns a boolean. It neither submits the form nor displays the browser's standard validation messages.
HTMLFormElement.reportValidity() checks validation constraints on controls associated with a form and can report errors to the user. It returns a boolean and does not itself submit the form.
requestSubmit() starts the standard form submission procedure, which can include validation and a submit event. An optional button identifies the submitter and can change submission settings. Unlike submit(), this method does not bypass these mechanisms.
HTMLFormElement.reset() restores the default state of controls associated with a form rather than simply emptying them. It first dispatches a cancelable reset event; preventDefault() stops the restoration.