-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doNotTrack property should be derived from EventTarget #13
Comments
Discuss again next time |
Lukewarm support: Will be decided March 27. |
The goal of this change is to allow a browser to notify a JavaScript program once a DNT preference is changed. IMHO this may put undue burden onto the browser: While it is easy to calculate a DNT value (check whether one cookie rule applies using the cookie-rules-engine), notifying all subscribing things that a rule was revoked may require extra code. The pure computation of a DNT value works like this:
Creating events seems substantially more complex:
If a rule is changed, check for each subscriber of the rule whether any other rule permits this pattern (if yes, move the subscription to the new rule). If not, notify the subscriber that the outcome has changed to DNT;1. Overall, this effort seems too much burden for a "nice to have" feature. |
There is no extra burden on the browser. The navigator.doNotTrack property "enables a client-side script with read access to the Navigator object to determine what DNT header field value would be sent in requests to the document-origin, taking into account the user's general preference (if any) and any user-granted exceptions applicable to that origin server". So now every time any of the following occurs:
the appropriate browsing context has to be calculated and its navigator.doNotTrack property has to be updated. The only extra step for the browser in my proposal is to trigger the event, only a few extra clock cycles (every browser already implements the event system) What I am suggesting is that immediately after the appropriate navigator.doNotTrack is updated, a dntUpdated event is dispatched, probably on the document object (or it also could be on the navigator object). i.e. if this is done in JS it would be: The browsing context interested in being notified when navigator.doNotTrack changes would have called: This gives developers a more elegant way to react to changes to DNT (they do not have to set up a setInterval or setTimeout callback with an arbitrary duration value). More importantly it allows them to associate an asynchronous callback when navigator.doNotTrack is guaranteed to have been updated. This allows the development of a "polyfill" script library that can simulate the Exception API even if it is not currently supported by the browser or a browser extension. An iframe context for a ad exchange or ad provider could sit on the event and be indicated if consent has been given (and recorded by the parent context (in probably a first-party cookie). If they just examine navigator.doNotTrack (i.e. not inside an asynchronous callback), this can only ever reflect the general preference in this use case (where the user agent does not implement the API). |
2017-05-1: Mike will propose text |
Here is the text to complete my action. Section 2 should be inserted after 5.3 in the TPE. |
2017-05-09 No consensus reached that there is an urgent need. May reconsider if significant implementor's pull. |
Following on from the last issue about returning a Promise, for consistency it would make sense to do the same for the doNotTrack property. Its value cannot be calculated simply before the document is loaded as it may change as a result of user action or calls to the API. Code that uses the API is likely to need to be notified when doNotTrack changes, and having to do it inside a setInterval call back is annoying.
rather than making it simply a DOMString we could derive it from EventTarget, so code could do things like:
navigator.doNotTrack.addEventListener( "consent", function(dnt){
// doNotTrack has changed, - read and act on it now!
// dnt=="1" means DNT header will be "1" in any requests to this origin
WebIDL
partial interface Navigator {
readonly attribute DoNotTrack doNotTrack;
};
interface DoNotTrack: EventTarget {
DOMString? val;
}
The text was updated successfully, but these errors were encountered: