whatwg / whatwg/html

Is beforeunload fired in all cases?

Open
#8,395 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

interop topic: javascript: URLs topic: navigation
Dominant language
HTML
Stars
9.4k
Forks
3.2k
PR merge metrics
PR metrics pending

Description

Based on some initial tests in https://github.com/web-platform-tests/wpt/pull/36488, in Chrome and Safari navigating or traversing to a javascript: URL does not fire beforeunload. Whereas in Firefox it does fire.

In the current spec all navigations and traversals fire beforeunload, whereas in the current state of the rewrite (#6315) only those which require a fetch will do so. So the following are the tricky cases:

  • javascript: URLs
  • srcdoc resources
  • embed/object
  • non-fetch scheme documents

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the initial tests in web-platform-tests PR 36488 and the navigation rewrite in issue #6315. Compare beforeunload behavior for javascript: URLs, srcdoc resources, embed/object, and non-fetch scheme documents, then document which cases the specification should require and ensure the rewrite is consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.