HTML5 Browser Geolocating

by , Nov. 02, 2010 at 08:01 PM

Scripts: html5

 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 :

  1. 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
  2. watchPostion : this method returns a Id value for the started watch operation
  3. 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:

  1. function init() {
  2. if (navigator.geolocation) {
  3. navigator.geolocation.getCurrentPosition(exportPosition, errorPosition);
  4. } else {
  5. getLocationYQL();
  6. document.getElementById('georesults').innerHTML = '<p>Your browser does not support HTML5 geolocation API.</p>';
  7. }
  8. }
  9. 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!

Available 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.

Natural hair care products

May. 27, 2014 at 09:05 AM

These are really great ideas in on the topic of blogging. You have touched some pleasant things here. Any way keep up wrinting.

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.

Leave a comment

Required!
Required!

Required!
Required!

Latest News

  • Sep. 16, 2014 at 19:21
    French Prime Minister Manuel Valls narrowly wins a crucial confidence vote in parliament, despite a recent cabinet revolt over austerity mea...
    Read more»
  • Sep. 16, 2014 at 19:12
    The UN says it needs $1bn to fight the West Africa Ebola outbreak, described as "unparalleled in modern times", as experts warn that time is...
    Read more»
  • Sep. 16, 2014 at 19:07
    South Sudan government issues an order to non-governmental organisations and private firms to fire foreign workers by mid-October amid an ai...
    Read more»
  • Sep. 16, 2014 at 19:02
    Two men die as a helicopter on its way to Humberside Airport crashes into the sea off the East Yorkshire coast.
    Read more»
  • Sep. 16, 2014 at 18:44
    Police looking for missing schoolgirl Alice Gross say there has been a new sighting of her rucksack and they are trying to trace a man who w...
    Read more»
  • Sep. 16, 2014 at 18:44
    US ground forces could be deployed against Islamic State militants if the current strategy fails, a top US general says.
    Read more»
  • Sep. 16, 2014 at 18:39
    Watch the latest news summary from BBC World News. International news updated 24 hours a day.
    Read more»
  • Sep. 16, 2014 at 18:14
    South Yorkshire's Police and Crime Commissioner Shaun Wright resigns over the Rotherham child abuse scandal.
    Read more»
  • Sep. 16, 2014 at 18:12
    The pro-independence camp in Scotland calls a devolution pledge by the main UK parties an "insult" while pro-union campaigners hail it as a ...
    Read more»
  • Sep. 16, 2014 at 18:11
    Why Xi Jinping's visit to India will be closely watched
    Read more»
  • Sep. 16, 2014 at 18:06
    Scientists in New Zealand have thawed and started to examine a rare colossal squid caught in a fisherman's net.
    Read more»
  • Sep. 16, 2014 at 17:55
    Russia needs to boost forces in Crimea because of the Ukraine crisis and a foreign military build-up, Russia's defence minister says.
    Read more»
  • Sep. 16, 2014 at 17:54
    Ukrainian MPs adopt a law granting special status to parts of eastern regions held by pro-Russian rebels and an amnesty for rebel fighters.
    Read more»
  • Sep. 16, 2014 at 17:48
    Tropical storm Odile is moving up Mexico's Baja California peninsula, bringing heavy rains and the threat of mudslides and flash floods.
    Read more»
  • Sep. 16, 2014 at 17:45
    Chinese footwear firm Ultrasonic has announced the disappearance of its chief executive and chief operating officer, along with most of its ...
    Read more»
  • Sep. 16, 2014 at 17:11
    Irate passengers prevent a senior Pakistani politician from boarding a flight, after they were kept on board for two hours until he arrived....
    Read more»
  • Sep. 16, 2014 at 17:10
    Cheaper food and fuel prices helped to push down the UK consumer price inflation rate to 1.5% in August, official figures show.
    Read more»
  • Sep. 16, 2014 at 17:02
    Panasonic unveils a hybrid smartphone-camera, at the Photokina trade show in Cologne.
    Read more»
  • Sep. 16, 2014 at 16:43
    A Taliban suicide car bomber attacks a foreign military convoy in the Afghan capital, Kabul, killing three Nato personnel and injuring at le...
    Read more»
  • Sep. 16, 2014 at 16:40
    Hiding in the dark during Algerian gas plant attack
    Read more»

Recent Comments:

Ehcjntublr

Jun. 11, 2014 at 06:06 PM

leebvfnnbovfmoebzjsbhjkf, http://www.pykbyrhrlo.com/ spdwthctlr

Natural hair care products

May. 27, 2014 at 09:05 AM

These are really great ideas in on the topic of blogging. You have touched some pleasant things here. Any way keep up wrinting.

Remedies for piles

May. 18, 2014 at 05:44 PM

Thanks for finally writing about > %blog_title% < Loved it!

Website

Mar. 25, 2014 at 08:19 PM

There are books, home study courses, workshops and other means of information, to gain the knowledge required to become the alpha leader. If you want ... Read more»

Titia

Feb. 15, 2014 at 01:48 AM

buy car insurance online prozac 40mg no rx best deals on vigra and cialis website auto insurance quoye www.evansvillecommunitytheatre.com ... Read more»

Archives:

Meet me on facebook: