Stackoverflow - app phonegap html

http://stackoverflow.com/q/11536000/918414

by Chandana Thota

HTML

<div id="location"></div>


















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































<script>

/* by: thinkingstiff.com
license: http://creativecommons.org/licenses/by-nc-sa/3.0/us/ */

var headerCaption = 'app phonegap html',
    headerUri = 'http://stackoverflow.com/q/11536000/918414';
    
document.body.insertAdjacentHTML( 
    'afterBegin',
      '<a href="' + headerUri + '" '
    + 'target="_top" '
    + 'onmouseover="this.style.opacity=\'.95\'" '
    + 'onmouseout="this.style.opacity=\'1\'" '
    + 'style="'
        + 'background-color: black;'
        + 'background-image: linear-gradient( top, rgba( 255, 255, 255, .3), rgba( 255, 255, 255, 0) );'
        + 'background-image:...

JavaScript

var location = document.getElementById( 'location' );

var geo = window.navigator.geolocation.watchPosition( function ( position ) {
        location.textContent = position.coords.latitude  + ', ' + position.coords.longitude;
    },
    function ( error ) {
        location.textContent = error.message;
    }
);