The example in this article describes the method of obtaining geolocation in HTML5 and is shared with everyone for your reference. The specific method is as follows:
html5 code for obtaining coordinates is as follows:
After testing, the coordinates can be successfully obtained on IE9, Firefox, Chrome, and Opera, but the coordinates cannot be returned on Safari 5.x. The reason has not yet been found. Among the successful cases, Chrome has the fastest response speed, followed by Opera, then IE9, and Firefox is actually the slowest. Personally, I am very disappointed with Firefox, but Chrome is getting better and better.
I hope this article will be helpful to everyone’s HTML5 programming design.