Created
April 19, 2013 20:34
-
-
Save wbamberg/5423045 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
manifest: | |
{ | |
"name": "Where am I?", | |
"description": "A simple web app", | |
"launch_path": "/index.html", | |
"icons": { | |
"128": "/style/icons/earth.png" | |
}, | |
"permissions": { | |
"geolocation": { | |
"description": "something important?" | |
} | |
} | |
} | |
code: | |
var whereami = document.getElementById('where-am-i'); | |
var whereiam = document.getElementById('where-i-am'); | |
whereami.onclick = function() { | |
navigator.geolocation.getCurrentPosition(success, error); | |
}; | |
function success(position) { | |
whereiam.innerHTML = position.coords.latitude + ", " + position.coords.longitude; | |
} | |
function error(error) { | |
console.log(error.code + " : " + error.message); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment