WEB-DEVELOPMENT-APPLICATIONS practice question 17 of 25
Which event occurs when a user closes a browser?
Full set: 131 questionsThe unload event is fired on the window object when the document is being unloaded. This process occurs when a user navigates away from the current page, which includes actions like clicking a link to another page, submitting a form, or closing the browser window or tab. It is traditionally used for cleanup tasks, though modern APIs like pagehide are now recommended for better reliability.
A. submit: This event is fired on a element when the user clicks a submit button or presses Enter, not when the browser closes.
C. abort: This event is fired when the loading of a resource (e.g., an image) has been aborted by the user, not when the browser window closes.
D. reset: This event is fired on a element when the user clicks a reset button, clearing the form's inputs.
1. Mozilla Developer Network (MDN). (2023). Window: unload event. In Web APIs. Retrieved from https://developer.mozilla.org/en-US/docs/Web/API/Window/unloadevent
2. WHATWG. (2024). HTML Living Standard. Section 8.1.5.5 "The unload event". Retrieved from https://html.spec.whatwg.org/multipage/browsing-the-web.html#event-unload
3. W3C. (2016). UI Events. Section 5.5 "Focus Events". (While this document focuses on UI events, it helps differentiate event types like unload from form-specific events like submit and reset). Retrieved from https://www.w3.org/TR/uievents/
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?
