THE WORLD'S LARGEST WEB DEVELOPER SITE

JS Reference

Overview

JavaScript

JS Array JS Boolean JS Date JS Error JS Global JS JSON JS Math JS Number JS Operators JS RegExp JS Statements JS String

HTML DOM

DOM Attribute DOM Console DOM Document DOM Element DOM Events DOM Event Objects DOM Geolocation DOM History DOM HTMLCollection DOM Location DOM Navigator DOM Screen DOM Style DOM Window WEB Storage

HTML Objects

<a> <abbr> <address> <area> <article> <aside> <audio> <b> <base> <bdo> <blockquote> <body> <br> <button> <canvas> <caption> <cite> <code> <col> <colgroup> <datalist> <dd> <del> <details> <dfn> <dialog> <div> <dl> <dt> <em> <embed> <fieldset> <figcaption> <figure> <footer> <form> <head> <header> <h1> - <h6> <hr> <html> <i> <iframe> <img> <ins> <input> button <input> checkbox <input> color <input> date <input> datetime <input> datetime-local <input> email <input> file <input> hidden <input> image <input> month <input> number <input> password <input> radio <input> range <input> reset <input> search <input> submit <input> text <input> time <input> url <input> week <kbd> <label> <legend> <li> <link> <map> <mark> <menu> <menuitem> <meta> <meter> <nav> <object> <ol> <optgroup> <option> <output> <p> <param> <pre> <progress> <q> <s> <samp> <script> <section> <select> <small> <source> <span> <strong> <style> <sub> <summary> <sup> <table> <td> <th> <tr> <textarea> <time> <title> <track> <u> <ul> <var> <video>

Other References

CSSStyleDeclaration JS Conversion


The Geolocation Object


Geolocation Object

The Geolocation object allows the user to provide their location to web applications. For privacy reasons, the user is asked for permission to report location information.

Note: This feature is available only in secure contexts (HTTPS).

Note: Geolocation is most accurate for devices with GPS, like iPhone.

The Geolocation API is published through the navigator.geolocation object.


Geolocation Object Properties

Property Description
coordinates Returns the position and altitude of the device on Earth
position Returns the position of the concerned device at a given time
positionError Returns the reason of an error occurring when using the geolocating device
positionOptions Describes an object containing option properties to pass as a parameter of Geolocation.getCurrentPosition() and Geolocation.watchPosition()

Geolocation Object Methods

Method Description
clearWatch() Unregister location/error monitoring handlers previously installed using Geolocation.watchPosition()
getCurrentPosition() Returns the current position of the device
watchPosition() Returns a watch ID value that then can be used to unregister the handler by passing it to the Geolocation.clearWatch() method