GeoLocation Object



 
The GeoLocation object allows you to use geolocation features provided by hardware sensors through the Windows operating system.


Members Table

    The following table lists the members provided by the GeoLocation object.

    Members

    Properties Description
    HighAccuracy Whether to use high accuracy.
    ReportInterval Contains the reporting interval.
    ReportStatus Contains the current status of the object.

    Methods Description
    GetAltitude Gets the current altitude.
    GetLatitude Gets the current latitude.
    GetLongitude Gets the current longitude.

    Events Description
    OnLocationChanged Fires when a location change is detected.
    OnStatusChanged Fires when a status change is detected.

Remarks
    This object is available through the main object SiteKiosk. Use the GeoLocation object to query the location of the device you run the script on.

    You need a sensor that provides geolocation information and is enabled under the Location and Other Sensors section of the Windows control panel. Note that the sensor might not only need to be active but require a working SIM card to provide actual GPS coordinates.

    Note that the path of a file using SiteKiosk objects must be allowed in the
    SiteKiosk configuration (Security -> Access -> URL's With Script Permission)
    if it is not a browser skin file.
Examples
    The following example sets the accuracy of the GeoLocation object to high and the report interval to 10 seconds. It will also show an alert window with the new location every time the sensor hardware fires the event that the location has changed.

    <SCRIPT TYPE="text/javascript">
    window.external.InitScriptInterface();
    
    if(SiteKiosk.GeoLocation != null && SiteKiosk.GeoLocation.
    ReportStatus == 4)
    {
       SiteKiosk.GeoLocation.HighAccuracy = true;
       SiteKiosk.GeoLocation.ReportInterval = 10000;
       
       SiteKiosk.GeoLocation.OnLocationChanged = OnLocationChanged;
       
       function OnLocationChanged(latitude,longitude,ole_time)
       {
          var time = new Date();
          time.setTime((ole_time - 25569) * 24 * 3600 * 1000);
          alert("New Location: " + latitude + " " +  longitude + 
          " " + time);
       }
    }
    </SCRIPT>

Applies to
    SiteKiosk v9.0 (and later versions).

Back to top