Skip to content

Clarify behavior of client.url#43844

Merged
wbamberg merged 3 commits into
mdn:mainfrom
wbamberg:fix-41483
May 29, 2026
Merged

Clarify behavior of client.url#43844
wbamberg merged 3 commits into
mdn:mainfrom
wbamberg:fix-41483

Conversation

@wbamberg
Copy link
Copy Markdown
Collaborator

@wbamberg wbamberg commented Apr 17, 2026

Fixes #41483, fixes #41482.

At least that's the idea.

My understanding of this, mostly from testing, is that Client.url isn't updated unless an actual page load happens, which means it isn't updated in situations such as:

  • the user navigates within the same page using a URL fragment like <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fpull%2F43844%23thing%26gt%3Bgo+to+thing%26lt%3B%2Fa%26gt%3B%3C%2Fcode%3E%3C%2Fli%3E%0A%3Cli%3Ethe+web+app+is+an+SPA+that+intercepts+navigation+events+%28for+example%2C+using+the+Navigation+API%29+and+updates+the+page+content+using+client-side+JavaScript%3C%2Fli%3E%0A%3C%2Ful%3E%0A%3Cp+dir%3D"auto">This is unituitive, partly because the value of Client.url would in these cases not match document.location.href or the URL bar.

    I've tested this, and have tried to express it. I'm not sure what the best language to use here is though.

    Side note, the Navigation API docs are lacking any guide docs. I had to read https://developer.chrome.com/docs/web-platform/navigation-api to understand how to use it, and that guide although good is quite out of date.

@wbamberg wbamberg requested a review from a team as a code owner April 17, 2026 18:44
@wbamberg wbamberg requested review from chrisdavidmills and removed request for a team April 17, 2026 18:44
@github-actions github-actions Bot added Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed labels Apr 17, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 17, 2026

Preview URLs (2 pages)

(comment last updated: 2026-05-29 15:21:07)

@wbamberg
Copy link
Copy Markdown
Collaborator Author

@chrisdavidmills , can I get a review of this?

Copy link
Copy Markdown
Contributor

@chrisdavidmills chrisdavidmills left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me, thanks @wbamberg. Just one language nit to sort out; approving so you can merge once that's done.


### Opening a window on a notification click

In this example a service worker creates and then shows a that contains an associated URL, which is under the service worker's scope. When the user clicks the notification:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"...shows a that..." - something missing here, but I'm not sure what.

Comment thread files/en-us/web/api/clients/openwindow/index.md Outdated
@wbamberg wbamberg merged commit ff42d1f into mdn:main May 29, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Very misleading example for window focus from notification / service worker Client URL does not change upon subsequent navigation

3 participants