geolocation property

Gets a reference to a geolocation object, which reports the geographic location of the device running the application.

Geolocation API Specification, Section 5.1Internet Explorer 9




p = object.geolocation


Property values

Type: Object

A reference to a geolocation object.

Standards information


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


The following example shows how to determine whether or not the geolocation object is supported before attempting to access it.

<!DOCTYPE html>  
<title>Geolocation example: Checking for geolocation support</title>
<meta http-equiv="X-UA-Compatible" context="IE=9">
<script type="text/javascript"> 
function show_islocationenabled()
  // Default to failure condition.
  var str = "No, geolocation is not supported.";  
  if (window.navigator.geolocation) {
    str = "Yes, geolocation is supported.";
  alert( str );
<input type="button" onclick="show_islocationenabled()" 
   value="Is Geolocation supported?" />

See also