Geolocation and Web Storage

0 / 5. 0

Geolocation in a Webpage Firstname LastnameUniversity Name Geolocation in a Webpage In HTML5, the geographical location of a user can be accessed through the geolocation API and JavaScript. As the user manually allows access to his/her geographical location, the feature does not compromise privacy (see Figure 1). Geolocation is supported in almost all the widely used browsers i.e. Firefox, Opera, Chrome, Internet Explorer and Safari. Figure SEQ Figure * ARABIC 1 API seeking user's permission To access a person’s location (i.e. the latitude and longitude), the Geolocation API is used as shown in Figure 2. A JavaScript function getLocation() uses the API to get user location. Figure SEQ Figure * ARABIC 2 Geolocation in WebPage - HTML Code Figure SEQ Figure * ARABIC 3 User Location Check Browser Support First it is checked through the global navigator object, navigator.geolocation, whether the Geolocation API is supported by the browser. If the API is not supported, a message can be displayed to indicate that to the user. Get User’s Location If the user’s browser supports Geolocation API, the navigator.geolocation object’s getCurrentPosition() function will execute and return the coordinates object. The function can be passed three parameters: showPosition (i.e. the callback function that would access the position details), showError (i.e. the callback function to reveal any errors) and optn (i.e. for setting options for position). Mostly only the showPosition parameter is used (as used in Figure 2). The showPosition() function is triggered only if the user has allowed discovery of his/her location and if the browser has successfully fetched

Related samples

Name Instructor’s name English 101 Date A Responsive Essay of the Article “Mommy, there's a Nigger at the Door” Ronald Jackson‘s article, “Mommy, there's a...

COMPARE AND CONTRAST THE SECONDARY EDUCATION SYSTEMS OF VIETNAM AND AUSTRALIA by (Name) The Name of the Class (Course) Professor (Tutor) The Name of the School...

The ecological benefits of rammed earth construction in medium density urban development Presented By Institution Date Introduction Technological innovations in recent...

Young and New Technology Student’s Name Institutional Affiliation Impacts of Technology on Children Research based on violence in mass media and their effect on...

Comments

Leave feedback

Your email address will not be published. Required fields are marked *