Collapse the table of content
Expand the table of content

coords property

Gets a reference to an IWebGeocoordinates object that contains geographic information returned by the IWebGeolocation::getCurrentPosition or IWebGeolocation::watchPosition functions.

Geolocation API Specification, Section 5.3Internet Explorer 9



HRESULT value = object.get_coords(IWebGeocoordinates** p);

Property values

Type: Object

A reference to the an IWebGeocoordinates object representing the geographic location, including latitude, longitude, and accuracy of the location data.

Standards information


The position is passed as a parameter to the callback function defined with the IWebGeolocation::getCurrentPosition function or the IWebGeolocation::watchPosition function.

Windows Internet Explorer 9. This property is supported only for webpages displayed in IE9 Standards mode. For more information, see Defining Document Compatibility.


The following example shows how to access the position object in the successCallback function. In this example, this object is named position.

<!DOCTYPE html>  
<title>Requesting Location</title>
<script type="text/javascript">
function setText(val, e) {
    document.getElementById(e).value = val;
function insertText(val, e) {
    document.getElementById(e).value += val;
var nav = null; 
function requestPosition() {
  if (nav == null) {
      nav = window.navigator;
  if (nav != null) {
      var geoloc = nav.geolocation;
      if (geoloc != null) {
      else {
          alert("geolocation not supported");
  else {
      alert("Navigator not found");
function successCallback(position)
   setText(position.coords.latitude, "latitude");
   setText(position.coords.longitude, "longitude");
<label for="latitude">Latitude: </label><input id="latitude" /> <br />
<label for="longitude">Longitude: </label><input id="longitude" /> <br />
<input type="button" onclick="requestPosition()" value="Get Latitude and Longitude"  /> 



Community Additions

© 2015 Microsoft