WEB-DEVELOPMENT-APPLICATIONS practice question 12 of 25
Which History API object is called when a browser window’s document history changes?
Full set: 131 questionsThe popstate event is dispatched to the window object every time the active history entry changes. The window.onpopstate property is the event handler that is called to process these popstate events. This occurs when the user navigates with the browser's back and forward buttons or when JavaScript calls history.back(), history.forward(), or history.go(). Therefore, window.onpopstate is the specific API member called when the document history changes.
A. window.location is an object providing URL information and methods for navigation; it is not an event handler for history changes.
C. window.name is a property for getting or setting the name of the window's browsing context, unrelated to history events.
D. window.open() is a method used to open new browser windows, not an event handler that responds to history navigation.
1. MDN Web Docs. (2023). Window: popstate event. Mozilla. Retrieved from https://developer.mozilla.org/en-US/docs/Web/API/Window/popstateevent. (This document explicitly states the popstate event is fired when the history entry changes).
2. MDN Web Docs. (2023). Window.onpopstate. Mozilla. Retrieved from https://developer.mozilla.org/en-US/docs/Web/API/Window/onpopstate. (This page defines onpopstate as the event handler for the popstate event).
3. WHATWG. (2023). HTML Living Standard. Section 8.8.3 "The PopStateEvent interface". Retrieved from https://html.spec.whatwg.org/multipage/nav-history-apis.html#the-popstateevent-interface.
Keep practicing
Take the free WEB-DEVELOPMENT-APPLICATIONS practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other WEB-DEVELOPMENT-APPLICATIONS practice questions
- Question 1Given the following JavaScript code: ```javascript var n1 = 10; var n2 = "20.39"; ``` Whi…
- Question 2Which attribute displays help text in an input field without specifying an actual value f…
- Question 4Which element attaches an external CSS document to a web page?
- Question 5Which HTML tag should a developer use to create a drop-down list?
- Question 6Which method allows the end user to enter text as an answer to a question as the page loa…
- Question 8Which layout design is easiest to manage on a variety of devices?
