In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Today, I would like to talk to you about how to locate HTML5. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something from this article.
HTML5 geographic positioning
Locate the location of the user (recommended study: html tutorial)
HTML5 Geolocation API is used to obtain the user's geographic location.
In view of the fact that this feature may infringe upon the user's privacy, the user location information is not available unless the user agrees.
Browser support
Internet Explorer 9, Firefox, Chrome, Safari, and Opera support geolocation.
Note: geolocation is more accurate for devices with GPS, such as iPhone.
HTML5-use geolocation
Use the getCurrentPosition () method to get the location of the user.
The following example is a simple geolocation example that returns the longitude and latitude of the user's location.
Example
Var x=document.getElementById ("demo"); function getLocation () {if (navigator.geolocation) {navigator.geolocation.getCurrentPosition (showPosition);} else {x [XSS _ clean] = "Geolocation is not supported by this browser.";}} function showPosition (position) {x [XSS _ clean] = "Latitude:" + position.coords.latitude + "Longitude:" + position.coords.longitude;}
Examples explain:
Detect whether geolocation is supported
If supported, run the getCurrentPosition () method. If not, a message is displayed to the user.
If getCurrentPosition () runs successfully, a coordinates object is returned to the function specified in the parameter showPosition
The showPosition () function gets and displays longitude and latitude
The above example is a very basic geolocation script with no error handling.
After reading the above, do you have any further understanding of how HTML5 is geographically located? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.