Comments (10)
Yeah... for everyone else's sake, let's quickly review navigationStart
:
https://w3c.github.io/navigation-timing/#dom-performancetiming-navigationstart
This attribute must return the time immediately after the user agent finishes prompting to unload the previous document. If there is no previous document, this attribute must return the time the current document is created.
The prompt to unload is when beforeunload
is run.
IIRC the original intent was that navigationStart
shouldn't begin until the navigation was committed to happening -- and since beforeunload
could (technically) cancel the navigation, navigationStart
shouldn't happen until after it had the chance to cancel it. So navigationStart
is after beforeunload
, right before unload
is triggered.
This presents the challenge you bring up -- in reality, the user's perception of what happened after the event that triggered the navigation sequence (such as user click) will be affected by long beforeunload
handlers. But we probably shouldn't at this point try to redefine navigationStart
to be earlier. And if not, since beforeunload
happens before navigationStart
, it would have a "negative" timestamp in relation to navigationStart
(the time origin).
Getting rid of timestamps completely:beforeUnloadDuration
? :)
from navigation-timing.
Do we want to expose this data to the next page, or do we want to expose it to the current one?
from navigation-timing.
Next page for me
- It's part of the critical path for the next page
- As many RUM products use beforeUnload to beacon data back, they wouldn't be able to grab the timings
@nicjansma I quite like duration, even though it's a different model to the other timings as not keen on -ve timings
What the timings look like when someone is prompted to cancel the navigation and they take a long time to respond might need a bit of thought.
from navigation-timing.
I'm guessing there will be some privacy/security consideration then for everything cross-origin (e.g. I'm not sure BigSearchEngineCompany.com would want every random site to be able measure what it does at beforeunload)
from navigation-timing.
I like beforeUnloadDuration
, but IMO it's value is lessened if we don't also measure total user "think time" - that is, time spent waiting for the user to dismiss an alert|confirm|prompt.
As for privacy/security, a script inlined in the page can measure these things:
https://gist.github.com/cvazac/4f22883563a334e03365a1c0c478fe92
from navigation-timing.
Moving to L3 as this is a request for new functionality.
from navigation-timing.
As discussed on the last call, unfortunately we cannot expose "duration of beforeunload of the previous" page to the next page. Doing so would leak private data both about the previous page, as well as the user if a prompt is presented. The current definition is specifically crafted to avoid this (as @nicjansma already noted earlier in #79 (comment)) and this behavior is by design.
Closing as a wontfix.
from navigation-timing.
from navigation-timing.
Same origin pages can already record and report this: instrument beforeunload and use sendBeacon to report the necessary timestamps.
from navigation-timing.
Don't see how this works - a site can instrument a beforeunload handler it adds but what about the ones 3rd party scripts add?
Currently gathering data on this and will be back when I've got it together
from navigation-timing.
Related Issues (20)
- Lack of Feature Parity with Performace.measure() in Level 2 HOT 5
- Should about:blank have a PerformanceNavigationTiming? HOT 7
- Add non-normative explanations for each of the attributes and when they are set or unset HOT 3
- Clarify spec and tests with respect to redirect info HOT 3
- Using navigationStart as a baseline may expose cross-origin timing information HOT 69
- How should prefetch be exposed? HOT 7
- Processing Model: Should 'prompt for unload' box actually be unload?
- Using "connectStart", "secureConnectionStart" and "connectEnd" with HTTP/3 flows HOT 5
- Reporting timestamps rely on a global object which might not exist yet HOT 1
- ToT spec has a bunch of respec warnings and errors HOT 1
- Should pages with different COOP be able to get unload event start/end. HOT 13
- Extend Navigation Timing API to include back/forward cache NotRestoredReasons HOT 4
- Links to "relevant application caches" are broken HOT 1
- Report that Critical-CH was used to restart a navigation HOT 5
- Extend the navigationType enum to include "reload after being discarded" navigations HOT 3
- Detecting whether a navigation was BFCache-eligible HOT 2
- Extend 'NavigationType' to include User Agent Launch HOT 13
- Clarify how PerformanceTiming.responseStart relates to Early Hint responses HOT 5
- performance.timeOrigin vs performance.timing.navigationStart HOT 3
- Extending the NavigationTimingType HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from navigation-timing.