SlideShare a Scribd company logo
HTML Geolocation
API
AWT Activity 1
Presented By:
A Vaibhav Jain, Suman Garai, Arvind Kumar, Subharanjan
Agenda
What is Geolocation
Supported Browsers
HTML Geolocation Implementation
Example Code
Error Handling
Example Code
Demo
Other interesting methods
3/24/2023 2
What is Geolocation?
• Geolocation refers to the geographical (latitudinal and longitudinal)
location of an Internet-connected device.
• Not your location, mind you, but the location of whatever electronic
medium is being used to access the Internet.
• Geolocation data can be collected on various basis, like, Device
based, Server Based, Hybrid.
3/24/2023 3
Supported Browsers
Above table shows the supported
browsers that supports
geolocation API.
HTML Geolocation
Implementation
3/24/2023 5
In order to implement the API, we must use the ‘navigator’ class of JavaScript, which
return the Geolocation object that gives web content access to the location of the
device.
Logic to implement the API:
• Check if Geolocation is supported.
• If supported, call the getCurrentPosition() method. Else, display error message.
• If the getCurrentPosition(parameter: showPosition) is called successfully, it
returns the coordinates object to the function specified in the parameter.
• The method showPosition() outputs the Latitude and Longitude.
getCurrentPosition() method accepts two parameters, first being, showPosition() and
the second is, showError()
Example Code
3/24/2023 6
<script>
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
function showPosition(position) {
x.innerHTML = "Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude +
"<br>Accuracy: " + position.coords.accuracy;
}
</script>
Error Handling
• As the second parameter, the getCurrentPosition() accepts
showError() method.
• This is used to handle errors. It specifies a function to run if it fails
to get the user’s location values.
• This method contains a set of possible errors that might occur while
accessing a user’s location are given below:
• Error.PERMISSION_DENIED
• Error.POSITION_UNAVAILABLE
• Error.TIMEOUT
• Error.UNKNOWN_ERROR
3/24/2023 7
Example Code
3/24/2023 8
<script>
function showError(error) {
switch(error.code) {
case error.PERMISSION_DENIED:
x.innerHTML = "User denied the request for Geolocation."
break;
case error.POSITION_UNAVAILABLE:
x.innerHTML = "Location information is unavailable."
break;
case error.TIMEOUT:
x.innerHTML = "The request to get user location timed out."
break;
case error.UNKNOWN_ERROR:
x.innerHTML = "An unknown error occurred."
break;
}
}
<script>
Return Data - getCurrentPosition()
Method
3/24/2023 9
Property Returns
coords.latitude The latitude as a decimal number (always returned)
coords.longitude The longitude as a decimal number (always returned)
coords.accuracy The accuracy of position (always returned)
coords.altitude The altitude in meters above the mean sea level (returned if
available)
coords.altitudeAccuracy The altitude accuracy of position (returned if available)
coords.heading The heading as degrees clockwise from North (returned if
available)
coords.speed The speed in meters per second (returned if available)
timestamp The date/time of the response (returned if available)
Demo
Click here to see the demo
3/24/2023 10
Screenshot of the program
3/24/2023 11
Other Interesting Methods
watchPosition()
Returns the current position of the
user and continues to return
updated position as the user
moves.
Syntax :
navigator.geolocation.watchPosi
tion(showPosition);
clearWatch()
3/24/2023 PRESENTATION TITLE 12
Stops the watchPosition() method.
Syntax:
navigator.geolocation.clearWacth();
Thank you

More Related Content

Similar to 20220816-GeolocationAPI-AdvancedWebDevelopment.pptx

Android App Development - 14 location, media and notifications
Android App Development - 14 location, media and notificationsAndroid App Development - 14 location, media and notifications
Android App Development - 14 location, media and notificationsDiego Grancini
 
iOS: Frameworks and Delegation
iOS: Frameworks and DelegationiOS: Frameworks and Delegation
iOS: Frameworks and DelegationJussi Pohjolainen
 
12.Maps and Location
12.Maps and Location12.Maps and Location
12.Maps and LocationNguyen Tuan
 
Mobile webapplication development
Mobile webapplication developmentMobile webapplication development
Mobile webapplication developmentGanesh Gembali
 
How to use geolocation in react native apps
How to use geolocation in react native appsHow to use geolocation in react native apps
How to use geolocation in react native appsInnovationM
 
Mobile geolocation and mapping
Mobile geolocation and mappingMobile geolocation and mapping
Mobile geolocation and mappingIvano Malavolta
 
Location-Based Services on Android
Location-Based Services on AndroidLocation-Based Services on Android
Location-Based Services on AndroidJomar Tigcal
 
Mobile Application Development-Lecture 15 & 16.pdf
Mobile Application Development-Lecture 15 & 16.pdfMobile Application Development-Lecture 15 & 16.pdf
Mobile Application Development-Lecture 15 & 16.pdfAbdullahMunir32
 
ADV JAVA UNIT 2 M.SC CS (1).pdf
ADV JAVA UNIT 2 M.SC CS (1).pdfADV JAVA UNIT 2 M.SC CS (1).pdf
ADV JAVA UNIT 2 M.SC CS (1).pdfKALAISELVI P
 
LUMIA APP LABS: HERE MAPS AND LOCATION APIS FOR WINDOWS PHONE
LUMIA APP LABS: HERE MAPS AND LOCATION APIS FOR WINDOWS PHONELUMIA APP LABS: HERE MAPS AND LOCATION APIS FOR WINDOWS PHONE
LUMIA APP LABS: HERE MAPS AND LOCATION APIS FOR WINDOWS PHONEMicrosoft Mobile Developer
 
Mobile applications chapter 6
Mobile applications chapter 6Mobile applications chapter 6
Mobile applications chapter 6Akib B. Momin
 
9781305078444 ppt ch10
9781305078444 ppt ch109781305078444 ppt ch10
9781305078444 ppt ch10Terry Yoast
 
GWT training session 3
GWT training session 3GWT training session 3
GWT training session 3SNEHAL MASNE
 
Windows phone 7 series
Windows phone 7 seriesWindows phone 7 series
Windows phone 7 seriesopenbala
 

Similar to 20220816-GeolocationAPI-AdvancedWebDevelopment.pptx (20)

Android App Development - 14 location, media and notifications
Android App Development - 14 location, media and notificationsAndroid App Development - 14 location, media and notifications
Android App Development - 14 location, media and notifications
 
iOS: Frameworks and Delegation
iOS: Frameworks and DelegationiOS: Frameworks and Delegation
iOS: Frameworks and Delegation
 
Geolocation and Mapping
Geolocation and MappingGeolocation and Mapping
Geolocation and Mapping
 
12.Maps and Location
12.Maps and Location12.Maps and Location
12.Maps and Location
 
Mobile webapplication development
Mobile webapplication developmentMobile webapplication development
Mobile webapplication development
 
How to use geolocation in react native apps
How to use geolocation in react native appsHow to use geolocation in react native apps
How to use geolocation in react native apps
 
Rmi
RmiRmi
Rmi
 
Mobile geolocation and mapping
Mobile geolocation and mappingMobile geolocation and mapping
Mobile geolocation and mapping
 
Chapter 05: Eclipse Vert.x - Service Discovery, Resilience and Stability Patt...
Chapter 05: Eclipse Vert.x - Service Discovery, Resilience and Stability Patt...Chapter 05: Eclipse Vert.x - Service Discovery, Resilience and Stability Patt...
Chapter 05: Eclipse Vert.x - Service Discovery, Resilience and Stability Patt...
 
Location-Based Services on Android
Location-Based Services on AndroidLocation-Based Services on Android
Location-Based Services on Android
 
Mobile Application Development-Lecture 15 & 16.pdf
Mobile Application Development-Lecture 15 & 16.pdfMobile Application Development-Lecture 15 & 16.pdf
Mobile Application Development-Lecture 15 & 16.pdf
 
ADV JAVA UNIT 2 M.SC CS (1).pdf
ADV JAVA UNIT 2 M.SC CS (1).pdfADV JAVA UNIT 2 M.SC CS (1).pdf
ADV JAVA UNIT 2 M.SC CS (1).pdf
 
LUMIA APP LABS: HERE MAPS AND LOCATION APIS FOR WINDOWS PHONE
LUMIA APP LABS: HERE MAPS AND LOCATION APIS FOR WINDOWS PHONELUMIA APP LABS: HERE MAPS AND LOCATION APIS FOR WINDOWS PHONE
LUMIA APP LABS: HERE MAPS AND LOCATION APIS FOR WINDOWS PHONE
 
Mobile applications chapter 6
Mobile applications chapter 6Mobile applications chapter 6
Mobile applications chapter 6
 
9781305078444 ppt ch10
9781305078444 ppt ch109781305078444 ppt ch10
9781305078444 ppt ch10
 
Geoloaction
GeoloactionGeoloaction
Geoloaction
 
Pushing the Web: Interesting things to Know
Pushing the Web: Interesting things to KnowPushing the Web: Interesting things to Know
Pushing the Web: Interesting things to Know
 
GWT training session 3
GWT training session 3GWT training session 3
GWT training session 3
 
Windows phone 7 series
Windows phone 7 seriesWindows phone 7 series
Windows phone 7 series
 
Core Location in iOS
Core Location in iOSCore Location in iOS
Core Location in iOS
 

More from Suman Garai

20230513-reconFTW-CyberSapiens.pdf
20230513-reconFTW-CyberSapiens.pdf20230513-reconFTW-CyberSapiens.pdf
20230513-reconFTW-CyberSapiens.pdfSuman Garai
 
20230324-Exploring the Landscape of Password Managers for Individual Users a...
20230324-Exploring the Landscape of Password Managers for  Individual Users a...20230324-Exploring the Landscape of Password Managers for  Individual Users a...
20230324-Exploring the Landscape of Password Managers for Individual Users a...Suman Garai
 
20230105-TestCases&Oracle-MobileTesting.pdf
20230105-TestCases&Oracle-MobileTesting.pdf20230105-TestCases&Oracle-MobileTesting.pdf
20230105-TestCases&Oracle-MobileTesting.pdfSuman Garai
 
20221003-DigitalForensicTools-DigitalForensicInvestigation.pdf
20221003-DigitalForensicTools-DigitalForensicInvestigation.pdf20221003-DigitalForensicTools-DigitalForensicInvestigation.pdf
20221003-DigitalForensicTools-DigitalForensicInvestigation.pdfSuman Garai
 
20220911-ISO27000-SecurityStandards.pptx
20220911-ISO27000-SecurityStandards.pptx20220911-ISO27000-SecurityStandards.pptx
20220911-ISO27000-SecurityStandards.pptxSuman Garai
 
20220819-Ecosystem-EnviornmentalScience.pptx
20220819-Ecosystem-EnviornmentalScience.pptx20220819-Ecosystem-EnviornmentalScience.pptx
20220819-Ecosystem-EnviornmentalScience.pptxSuman Garai
 
20220728-iOSAppDev-MobileAppDev.pptx
20220728-iOSAppDev-MobileAppDev.pptx20220728-iOSAppDev-MobileAppDev.pptx
20220728-iOSAppDev-MobileAppDev.pptxSuman Garai
 
20210906-Nessus-FundamentalInfoSec.ppsx
20210906-Nessus-FundamentalInfoSec.ppsx20210906-Nessus-FundamentalInfoSec.ppsx
20210906-Nessus-FundamentalInfoSec.ppsxSuman Garai
 
20210727-Technoprenuership-EntreprenuershipDev.ppsx
20210727-Technoprenuership-EntreprenuershipDev.ppsx20210727-Technoprenuership-EntreprenuershipDev.ppsx
20210727-Technoprenuership-EntreprenuershipDev.ppsxSuman Garai
 
20210717-AntiBotnets-FundamentalInfoSec.pptx
20210717-AntiBotnets-FundamentalInfoSec.pptx20210717-AntiBotnets-FundamentalInfoSec.pptx
20210717-AntiBotnets-FundamentalInfoSec.pptxSuman Garai
 
20210417-cppRelevancy-DataStructures.pptx
20210417-cppRelevancy-DataStructures.pptx20210417-cppRelevancy-DataStructures.pptx
20210417-cppRelevancy-DataStructures.pptxSuman Garai
 

More from Suman Garai (11)

20230513-reconFTW-CyberSapiens.pdf
20230513-reconFTW-CyberSapiens.pdf20230513-reconFTW-CyberSapiens.pdf
20230513-reconFTW-CyberSapiens.pdf
 
20230324-Exploring the Landscape of Password Managers for Individual Users a...
20230324-Exploring the Landscape of Password Managers for  Individual Users a...20230324-Exploring the Landscape of Password Managers for  Individual Users a...
20230324-Exploring the Landscape of Password Managers for Individual Users a...
 
20230105-TestCases&Oracle-MobileTesting.pdf
20230105-TestCases&Oracle-MobileTesting.pdf20230105-TestCases&Oracle-MobileTesting.pdf
20230105-TestCases&Oracle-MobileTesting.pdf
 
20221003-DigitalForensicTools-DigitalForensicInvestigation.pdf
20221003-DigitalForensicTools-DigitalForensicInvestigation.pdf20221003-DigitalForensicTools-DigitalForensicInvestigation.pdf
20221003-DigitalForensicTools-DigitalForensicInvestigation.pdf
 
20220911-ISO27000-SecurityStandards.pptx
20220911-ISO27000-SecurityStandards.pptx20220911-ISO27000-SecurityStandards.pptx
20220911-ISO27000-SecurityStandards.pptx
 
20220819-Ecosystem-EnviornmentalScience.pptx
20220819-Ecosystem-EnviornmentalScience.pptx20220819-Ecosystem-EnviornmentalScience.pptx
20220819-Ecosystem-EnviornmentalScience.pptx
 
20220728-iOSAppDev-MobileAppDev.pptx
20220728-iOSAppDev-MobileAppDev.pptx20220728-iOSAppDev-MobileAppDev.pptx
20220728-iOSAppDev-MobileAppDev.pptx
 
20210906-Nessus-FundamentalInfoSec.ppsx
20210906-Nessus-FundamentalInfoSec.ppsx20210906-Nessus-FundamentalInfoSec.ppsx
20210906-Nessus-FundamentalInfoSec.ppsx
 
20210727-Technoprenuership-EntreprenuershipDev.ppsx
20210727-Technoprenuership-EntreprenuershipDev.ppsx20210727-Technoprenuership-EntreprenuershipDev.ppsx
20210727-Technoprenuership-EntreprenuershipDev.ppsx
 
20210717-AntiBotnets-FundamentalInfoSec.pptx
20210717-AntiBotnets-FundamentalInfoSec.pptx20210717-AntiBotnets-FundamentalInfoSec.pptx
20210717-AntiBotnets-FundamentalInfoSec.pptx
 
20210417-cppRelevancy-DataStructures.pptx
20210417-cppRelevancy-DataStructures.pptx20210417-cppRelevancy-DataStructures.pptx
20210417-cppRelevancy-DataStructures.pptx
 

Recently uploaded

Pvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdfPvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdfPvtaan
 
ER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAEER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAEHimani415946
 
Production 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptxProduction 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptxChloeMeadows1
 
Article writing on excessive use of internet.pptx
Article writing on excessive use of internet.pptxArticle writing on excessive use of internet.pptx
Article writing on excessive use of internet.pptxabhinandnam9997
 
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理aagad
 
Statistical Analysis of DNS Latencies.pdf
Statistical Analysis of DNS Latencies.pdfStatistical Analysis of DNS Latencies.pdf
Statistical Analysis of DNS Latencies.pdfOndejSur
 
Cyber Security Services Unveiled: Strategies to Secure Your Digital Presence
Cyber Security Services Unveiled: Strategies to Secure Your Digital PresenceCyber Security Services Unveiled: Strategies to Secure Your Digital Presence
Cyber Security Services Unveiled: Strategies to Secure Your Digital PresencePC Doctors NET
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesSanjeev Rampal
 
Bug Bounty Blueprint : A Beginner's Guide
Bug Bounty Blueprint : A Beginner's GuideBug Bounty Blueprint : A Beginner's Guide
Bug Bounty Blueprint : A Beginner's GuideVarun Mithran
 
Premier Mobile App Development Agency in USA.pdf
Premier Mobile App Development Agency in USA.pdfPremier Mobile App Development Agency in USA.pdf
Premier Mobile App Development Agency in USA.pdfappinfoedgeca
 
Case study on merger of Vodafone and Idea (VI).pptx
Case study on merger of Vodafone and Idea (VI).pptxCase study on merger of Vodafone and Idea (VI).pptx
Case study on merger of Vodafone and Idea (VI).pptxAnkitscribd
 
The Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case StudyThe Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case StudyDamar Juniarto
 
How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?Linksys Velop Login
 
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkkaudience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkklolsDocherty
 

Recently uploaded (14)

Pvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdfPvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdf
 
ER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAEER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAE
 
Production 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptxProduction 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptx
 
Article writing on excessive use of internet.pptx
Article writing on excessive use of internet.pptxArticle writing on excessive use of internet.pptx
Article writing on excessive use of internet.pptx
 
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理
 
Statistical Analysis of DNS Latencies.pdf
Statistical Analysis of DNS Latencies.pdfStatistical Analysis of DNS Latencies.pdf
Statistical Analysis of DNS Latencies.pdf
 
Cyber Security Services Unveiled: Strategies to Secure Your Digital Presence
Cyber Security Services Unveiled: Strategies to Secure Your Digital PresenceCyber Security Services Unveiled: Strategies to Secure Your Digital Presence
Cyber Security Services Unveiled: Strategies to Secure Your Digital Presence
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
 
Bug Bounty Blueprint : A Beginner's Guide
Bug Bounty Blueprint : A Beginner's GuideBug Bounty Blueprint : A Beginner's Guide
Bug Bounty Blueprint : A Beginner's Guide
 
Premier Mobile App Development Agency in USA.pdf
Premier Mobile App Development Agency in USA.pdfPremier Mobile App Development Agency in USA.pdf
Premier Mobile App Development Agency in USA.pdf
 
Case study on merger of Vodafone and Idea (VI).pptx
Case study on merger of Vodafone and Idea (VI).pptxCase study on merger of Vodafone and Idea (VI).pptx
Case study on merger of Vodafone and Idea (VI).pptx
 
The Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case StudyThe Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case Study
 
How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?
 
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkkaudience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
 

20220816-GeolocationAPI-AdvancedWebDevelopment.pptx

  • 1. HTML Geolocation API AWT Activity 1 Presented By: A Vaibhav Jain, Suman Garai, Arvind Kumar, Subharanjan
  • 2. Agenda What is Geolocation Supported Browsers HTML Geolocation Implementation Example Code Error Handling Example Code Demo Other interesting methods 3/24/2023 2
  • 3. What is Geolocation? • Geolocation refers to the geographical (latitudinal and longitudinal) location of an Internet-connected device. • Not your location, mind you, but the location of whatever electronic medium is being used to access the Internet. • Geolocation data can be collected on various basis, like, Device based, Server Based, Hybrid. 3/24/2023 3
  • 4. Supported Browsers Above table shows the supported browsers that supports geolocation API.
  • 5. HTML Geolocation Implementation 3/24/2023 5 In order to implement the API, we must use the ‘navigator’ class of JavaScript, which return the Geolocation object that gives web content access to the location of the device. Logic to implement the API: • Check if Geolocation is supported. • If supported, call the getCurrentPosition() method. Else, display error message. • If the getCurrentPosition(parameter: showPosition) is called successfully, it returns the coordinates object to the function specified in the parameter. • The method showPosition() outputs the Latitude and Longitude. getCurrentPosition() method accepts two parameters, first being, showPosition() and the second is, showError()
  • 6. Example Code 3/24/2023 6 <script> function getLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition); } else { x.innerHTML = "Geolocation is not supported by this browser."; } } function showPosition(position) { x.innerHTML = "Latitude: " + position.coords.latitude + "<br>Longitude: " + position.coords.longitude + "<br>Accuracy: " + position.coords.accuracy; } </script>
  • 7. Error Handling • As the second parameter, the getCurrentPosition() accepts showError() method. • This is used to handle errors. It specifies a function to run if it fails to get the user’s location values. • This method contains a set of possible errors that might occur while accessing a user’s location are given below: • Error.PERMISSION_DENIED • Error.POSITION_UNAVAILABLE • Error.TIMEOUT • Error.UNKNOWN_ERROR 3/24/2023 7
  • 8. Example Code 3/24/2023 8 <script> function showError(error) { switch(error.code) { case error.PERMISSION_DENIED: x.innerHTML = "User denied the request for Geolocation." break; case error.POSITION_UNAVAILABLE: x.innerHTML = "Location information is unavailable." break; case error.TIMEOUT: x.innerHTML = "The request to get user location timed out." break; case error.UNKNOWN_ERROR: x.innerHTML = "An unknown error occurred." break; } } <script>
  • 9. Return Data - getCurrentPosition() Method 3/24/2023 9 Property Returns coords.latitude The latitude as a decimal number (always returned) coords.longitude The longitude as a decimal number (always returned) coords.accuracy The accuracy of position (always returned) coords.altitude The altitude in meters above the mean sea level (returned if available) coords.altitudeAccuracy The altitude accuracy of position (returned if available) coords.heading The heading as degrees clockwise from North (returned if available) coords.speed The speed in meters per second (returned if available) timestamp The date/time of the response (returned if available)
  • 10. Demo Click here to see the demo 3/24/2023 10
  • 11. Screenshot of the program 3/24/2023 11
  • 12. Other Interesting Methods watchPosition() Returns the current position of the user and continues to return updated position as the user moves. Syntax : navigator.geolocation.watchPosi tion(showPosition); clearWatch() 3/24/2023 PRESENTATION TITLE 12 Stops the watchPosition() method. Syntax: navigator.geolocation.clearWacth();