Challenge : File permission for a javascript file | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grátis
0

Challenge : File permission for a javascript file

Run the file only when the user permits it. eg : location, camera etc

13th Oct 2017, 2:52 AM
Ashwani Kumar
Ashwani Kumar - avatar
1 Resposta
+ 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
14th Nov 2017, 6:27 AM
#RahulVerma
#RahulVerma - avatar