0
Challenge : File permission for a javascript file
Run the file only when the user permits it. eg : location, camera etc
1 Answer
+ 3
Use prompt for this purpose
// The code, not the exact
locn = prompt('This site wants to access your location');
if(locn == true){
geolocation.getCurrentPosition();
}
// Output:
This site wants to access your location
OK(true) CANCEL(false)
// OK and CANCEL are buttons