W3C home > Mailing lists > Public > public-sysapps@w3.org > May 2014

Re: Permissions UI & Necessary API

From: Marcos Caceres <w3c@marcosc.com>
Date: Fri, 2 May 2014 18:40:10 -0400
To: public-sysapps@w3.org, Doug Reeder <reeder_29@yahoo.com>, Dave Raggett <dsr@w3.org>
Message-ID: <etPan.53641eca.10233c99.aa59@Marcoss-MacBook-Pro.local>


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

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:36:20 UTC