Skip to content

PageSwapEvent – Safari does not trigger this event for cross-origin navigations #28973

@bramus

Description

@bramus

What type of issue is this?

Incorrect support data (example: BrowserX says "86" but support was added in "40")

What information was incorrect, unhelpful, or incomplete?

Safari does not trigger the pageswap event for cross-origin navigations. It only does so for same-origin navigations.

Try it:

window.addEventListener('pageswap', console.log);

What browsers does this problem apply to, if applicable?

Safari

What did you expect to see?

I would expect to see a message logged in the console when navigating away to the next (cross-origin) page.

Did you test this? If so, how?

Using a test page:

  1. Visit https://chrome.dev/event-logger/. Click on “navigate away (same-origin)”
  2. Note the presence of pageswap in the list
  3. Click on “navigate away (example.com)”
  4. Hit the UA back button
  5. Note the lack of pageswap in the listIf you want to try yourself, create two pages and add the following in a blocking script in the head:

Manual:

window.addEventListener('pageswap', console.log);

Can you link to any release notes, bugs, pull requests, or MDN pages related to this?

https://bugs.webkit.org/show_bug.cgi?id=306447

Do you have anything more you want to share?

No response

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/Window/pageswap_event

MDN metadata

No response

Metadata

Metadata

Assignees

Labels

data:apiCompat data for Web APIs. https://developer.mozilla.org/docs/Web/APIp3Medium priority – Community PRs encouraged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions