The DNT header field is a mechanism for expressing the user's tracking preference in an HTTP request. At most one DNT header field can be present in a valid request.
DNT-field-name = "DNT"
DNT-field-value = ("0" / "1") *DNT-extension
- A user agent MUST NOT generate a DNT header field if the user's
tracking preference is not enabled.
- A user agent MUST generate a DNT header field with a field-value
that begins with the numeric character "1" if the user's tracking
preference is enabled, their preference is for DNT:1, and no
exception has been granted for the request target.
- A user agent MUST generate a DNT header field with a field-value that
begins with the numeric character "0" if the user's tracking
preference is enabled and their preference is for DNT:0, or if an
exception has been granted for the request target.
- A proxy MUST NOT generate a DNT header field unless it has been
specifically installed or configured to do so by the user making the
request and adheres to the above requirements as if it were a user
agent.
Here are some Methods to Request a Site-specific Exception:
void storeSiteSpecificTrackingException (StoreSiteSpecificExceptionPropertyBag properties)
This is called by a page to store a site-specific tracking exception. The storeSiteSpecificTrackingException
method takes a dictionary argument of type StoreSiteSpecificExceptionPropertyBag that allows optional information to be provided.
DOMString? domain
This is a cookie-domain to which the exception applies.
DOMString? siteName
A user-readable string for the name of the top-level origin.
DOMString? explanationString
A short explanation of the request.
DOMString? detailURI
A location at which further information about this request can be found.
DOMString? expires
A date and time, encoded as described for the cookie expires attribute indicating the maximum lifetime of the remembered grant.
long? maxAge
A positive number of seconds indicating the maximum lifetime of the remembered grant.
sequence arrayOfDomainStrings
A JavaScript array of strings. If the request does not include the arrayOfDomainStrings
, then this request is for a site-wide exception. Otherwise each string in arrayOfDomainStrings specifies a target. When called, storeSiteSpecificTrackingException
MUST return immediately. If the list arrayOfDomainStrings is supplied, the user agent MAY choose to store a site-wide exception. If it does so it MUST indicate this in the return value.
So, as an answer to your first question how to ask for an exception ?, I would suggest you to do this :
Navigator.storeSiteSpecificTrackingException
And if you would like to remove the permission grants, then do this:
Navigator.removeSiteSpecificTrackingException
There is no callback for removeSiteSpecificTrackingException
. After the call has been made, it is assured that there are no site-specific or site-wide exceptions for the given top-level origin.
And as an answer to your second question how to see whether or not the exception preferences on a website is accepted or not ?, confirmSiteSpecificTrackingException
is a method used for the same:
boolean confirmSiteSpecificTrackingException (ConfirmSiteSpecificExceptionPropertyBag properties)
This method is called by a page to confirm a site-specific tracking exception.
So all that you have to do is:
Navigator.confirmSiteSpecificTrackingException