HTML5 Browser Geolocating
by Emmanuel Ndayiragije, Nov. 02, 2010 at 08:01 PM
Who has ever thought it is posible to get geographic location data through the web browse? HML5 has made a break down with its new Geolocation API discribed in its specification.
Of not browser support this API like IE8, hopefully IE9 will support it. However, you can check this geolocation in others browsers as they are others advanced one: Firefox, Chrome Safari, ...
The Geolocation object is used by scripts to programmatically determine the location information associated with the hosting device. The location information is acquired by applying a user-agent specific algorithm, creating a Position object, and populating that object with appropriate data accordingly.
Objects implementing the Navigator interface (e.g. the window.navigator object) must also implement the NavigatorGeolocation interface [NAVIGATOR].
An instance of NavigatorGeolocation would be then obtained by using binding-specific casting methods on an instance of Navigator. This NavigatorGeolocation will provide a read-only object: Geolocation, it means you won't change its value. However it has three methods which are interessing for use to make the API work.
These are :
- getCurrentPosition: this method as it says, it is however a void method, it provide the postion's coordinates and so a callback function for this purpose
- watchPostion : this method returns a Id value for the started watch operation
- clearWatch: what does this method is clearing the watchPosition operation of the ID value the operation in execution
The best of the two last methods is you can build an itinerary navigator, itinerary parcours calculator, other apps. "wachPosition" returns periodically actual coords of the position of the navigator, in this case your phone, or other mobile devices connected to net.
Suppose you got your ephoney, or andoid phone, you may build an web application can that find shops, libraries, musea of the area where you are arriving.
Example javascript code:
function init() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(exportPosition, errorPosition); } else { getLocationYQL(); document.getElementById('georesults').innerHTML = '<p>Your browser does not support HTML5 geolocation API.</p>'; } } window.onload = init;
Note :
However the geoloaction API of HTML isn't yet enough accurate compared to the other GPS systems we know till now. But good people at W3C are working on it, i hope soon will be real to use this API.
Want to check this, visit this link : HTML5 geolocating you!
Post Comment|
Permant linksAvailable Comments :
Cr.frozen
Nov. 12, 2010 at 11:33 AM
Html5 geolocation is not accurate?
How come?
Administrator
Nov. 12, 2010 at 11:56 AM
The inaccuracy of the Geolocation Api of html5 may be it use the IP from your internet provider or ur pc has no GPS tools installed on it. Geolocation Api of html5 works fine with mobile internet, Android phones, iPhone and other Smart phones.
Howeever, i tested this api from my home, it gives an accuracy of 40 meters.
Html5 is still development.
Kamberley
May. 07, 2013 at 10:57 AM
Pleasing to find soemone who can think like that
Your Attention! Please do not post message with spam on this blog. We try to be cool to each other and post relevant comments and relating to the appropriated topic or entry. Let's try to get a nice conversation over here.
Entry Categories:
Latest News
- May. 21, 2013 at 10:03
David Cameron emails all Tory activists to praise their "decency and duty" in an attempt to mend relations after alleged "loon" slurs by a s...
Read more» - May. 21, 2013 at 09:58
Watch the latest news summary from BBC World News. International news updated 24 hours a day.
Read more» - May. 21, 2013 at 09:49
At least 91 people, including 20 children, are feared dead as a gigantic tornado rips through Oklahoma City suburbs, flattening whole neighb...
Read more» - May. 21, 2013 at 09:35
Marks and Spencer reports a big fall in annual profits, as troubles in its clothing division continue.
Read more» - May. 21, 2013 at 09:34
Ray Manzarek, keyboard player and founder member of the 1960s rock band The Doors, dies aged 74 in Germany after a long battle with cancer.
Read more» - May. 21, 2013 at 09:27
Vodafone's full-year sales slip for the first time in eight years as tough economic conditions in Europe take their toll on customers.
Read more» - May. 21, 2013 at 09:12
The BBC Young Musician of the year launches its 2014 talent search, which includes a new Jazz Award.
Read more» - May. 21, 2013 at 08:49
A study showing how ants tunnel their way through confined spaces could aid the design of search and rescue robots, say scientists.
Read more» - May. 21, 2013 at 07:25
The underwater prowess of the penguin may have cost the bird its ability to fly, scientists believe.
Read more» - May. 21, 2013 at 07:19
President Barack Obama praises the leadership of Burma's Thein Sein after historic White House talks, but urges his visitor to halt violence...
Read more» - May. 21, 2013 at 07:11
Apple is accused of being "among America's largest tax avoiders" by a Senate committee, who says the company avoided paying billions of doll...
Read more» - May. 21, 2013 at 06:20
Guatemalan former military leader Efrain Rios Montt has his conviction for genocide overturned by the constitutional court.
Read more» - May. 21, 2013 at 06:00
A Chinese fishing crew seized by unidentified North Koreans two weeks ago is freed along with their boat, reports say.
Read more» - May. 21, 2013 at 05:11
The US and Chinese presidents, Barack Obama and Xi Jinping, announce they will hold their first summit in California in June.
Read more» - May. 21, 2013 at 05:05
Scientists have used plant samples collected in the 19th Century to identify the pathogen that caused the Irish potato famine.
Read more» - May. 21, 2013 at 05:00
The people who trade garlic for ice cream
Read more» - May. 21, 2013 at 04:57
The songs readers most enjoy when they are feeling low
Read more» - May. 21, 2013 at 04:48
What happens when a piece of art is branded "iconic"?
Read more» - May. 21, 2013 at 04:31
The family of a woman murdered by her ex-partner call for a public inquiry into how complaints of domestic violence are handled by police.
Read more» - May. 21, 2013 at 04:22
How does a religion change what it believes?
Read more»
Recent Comments:
May. 07, 2013 at 10:57 AM
Pleasing to find soemone who can think like that
May. 07, 2013 at 10:51 AM
Thinking like that is really amaizng
Oct. 27, 2012 at 03:57 PM
That framework (Kazinduzi) is right good, & simple to use, i download it and set it on my ubuntu box, it just works fine. good work, man.
Oct. 27, 2012 at 03:56 PM
Great framework, it works fine on my server.
Jun. 29, 2012 at 05:27 PM
Reaction to "Cheap online prescription glasses".
Thanks for your appreciation to my blog.
Of course this blog is about to publish my own expe... Read more»
Archives:
- Playing video and audio with HTML5 July 23, 2010
- Aggregating objects within PHP5 June 26, 2010
- Creating a login system in your website May 05, 2010
- How to Setup your own Webserver May 05, 2010
- Welcome Entry May 05, 2010

United States




