Re: Permissions UI & Necessary API

On April 26, 2014 at 5:52:46 AM, Dave Raggett (dsr@w3.org) wrote:
> a. user has yet to be asked for a decision
> b. user has previously granted permission
> c. user has explicitly denied permission

It might be interesting to map these out for various APIs. For example, Geolocation:

> a. user has yet to be asked for a decision

The developer can record this in localStorage. 

localStorage.geoEnabled = "haven't asked yet".  

> b. user has previously granted permission

navigator.geolocation.getCurrentPosition(function(){
if(!localStorage.geoEnabled !== "yep"){
  localStorage.geoEnabled = "yep" 
});


> c. user has explicitly denied permission

navigator.geolocation.watchPosition(function(e){}, 
function(e){ 
  \\1 === PERMISSION_DENIED
  if(e.code === "1") {localStorage.geoEnabled = "denied"}; 
});


So, with Geolocation you might have enough information. 

Received on Friday, 2 May 2014 22:40:39 UTC