- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How does mobile safari determine when to prompt the user to share location in HTML?
When we have a requirement in which we want to track the latest locations for a user only when they are in a certain area, then we write separate code for it. The code to determine when to prompt the user to share location in HTML is as follows -
if (frstTime) { //First time navigator.getCurrentPosition(function (coordinates) { if (coordsAreInTheBox) { storeCoordsForUser(); navigator.watchPosition(); } }); } else if (userInlocat) { navigator.watchPosition(); }
It works as expected on the first load. It will check for whether the user came for the first time; if yes, then the navigator gets the current position. After that, according to coordinates in the box, we watch positions. If the user is in location then watch position.
- Related Articles
- Getting Safari to recognize HTML 5
- Raise the Mobile Safari HTML5 application cache limit?
- What does a user expect from a mobile app
- How does Selenium Webdriver handle the SSL certificate in Safari?
- HTML5 geolocation 'permission denied' error in Mobile Safari
- Execute a script when a user navigates to a page in HTML?
- Does Selenium support Safari browser?
- How to specify that the target will be downloaded when a user clicks on the hyperlink in HTML?
- Execute a script when the element gets user input in HTML?
- How to use FastClick with jQuery Mobile the right way in HTML?
- The simplest way to get the user's current location on Android
- How to take user input using HTML forms?
- How to specify that the details should be visible to the user in HTML?
- Execute a script when the user opens or closes the element in HTML?
- Execute a script when a user releases a key in HTML?

Advertisements