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

  • Aug. 22, 2014 at 11:44
    Senegal closes its border with Guinea because of the deadly Ebola outbreak, despite WHO warnings that such measures are counter-productive.
    Read more»
  • Aug. 22, 2014 at 11:43
    The League Managers' Association apologises for the wording of its statement defending Malky Mackay over offensive texts.
    Read more»
  • Aug. 22, 2014 at 11:32
    Lorries from a Russian aid convoy stream into Ukraine without permission after Russia accuses Ukraine of "intolerable" obstructions.
    Read more»
  • Aug. 22, 2014 at 11:28
    More than 191,000 people have been killed in the Syria conflict up to April, UN says.
    Read more»
  • Aug. 22, 2014 at 11:22
    Veteran MPs Jack Straw and Margaret Beckett urge further scrutiny of the proposed appointment of the new House of Commons clerk amid a conti...
    Read more»
  • Aug. 22, 2014 at 11:22
    The world's only two flying Lancasters have been united with a Vulcan bomber in a formation flight described as a "never to be repeated" eve...
    Read more»
  • Aug. 22, 2014 at 11:21
    President Nicolas Maduro of Venezuela has announced a mandatory fingerprinting system in supermarkets to combat food shortages and smuggling...
    Read more»
  • Aug. 22, 2014 at 11:11
    Russian EU food sanctions hit just before the Polish apple crop harvests leaving farmers with a glut of unsold fruit.
    Read more»
  • Aug. 22, 2014 at 10:58
    A section of the M25 in Essex was closed and there were "severe" delays, following a lorry fire which damaged the surface of the carriageway...
    Read more»
  • Aug. 22, 2014 at 10:53
    Malaysians observe a moment of silence following the arrival of the bodies of 20 victims of Flight MH17 which crashed in Ukraine in July.
    Read more»
  • Aug. 22, 2014 at 10:47
    Mario Balotelli's Liverpool move will not happen in time for the striker to face former club Manchester City on Monday.
    Read more»
  • Aug. 22, 2014 at 10:13
    More people are suffering from malnutrition as a result of worsening food poverty, health experts warn.
    Read more»
  • Aug. 22, 2014 at 10:11
    Failing doctors could be forced to apologise to patients under measures being considered by the medical regulator.
    Read more»
  • Aug. 22, 2014 at 10:08
    A man convicted of murdering two children is acquitted by China's highest court, in a rare move.
    Read more»
  • Aug. 22, 2014 at 10:03
    The London Stock Exchange is raising £938m in a shareholders rights issue to help fund a £1.6bn US acquisition.
    Read more»
  • Aug. 22, 2014 at 08:29
    Two tourist buses collide near Sharm El-Sheikh in Egypt's Sinai peninsula, leaving 33 people dead and 41 injured, officials say.
    Read more»
  • Aug. 22, 2014 at 07:19
    Gibraltar is planning to banish some of its Barbary macaque population which have become too cheeky or aggressive
    Read more»
  • Aug. 22, 2014 at 06:57
    Authorities in the southern Indian state of Kerala outline plans to ban the sale and consumption of alcohol to tackle the state's drink prob...
    Read more»
  • Aug. 22, 2014 at 06:04
    Islamic State militants in Syria and Iraq are the most dangerous threat the US has faced in recent years, senior American officials warn.
    Read more»
  • Aug. 22, 2014 at 05:48
    Watch the latest news summary from BBC World News. International news updated 24 hours a day.
    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: