Created
September 10, 2009 13:35
-
-
Save adaptive/184552 to your computer and use it in GitHub Desktop.
Geo Location Iphone
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>iPhone 3.0 geolocation demo</title> | |
<meta content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" name="viewport"/> | |
<script> | |
function handler(location) { | |
var message = document.getElementById("message"); | |
message.innerHTML ="<img src='http://maps.google.com/staticmap?center=" + location.coords.latitude + "," + location.coords.longitude + "&size=300x200&maptype=hybrid&zoom=16&key=YOURGOOGLEAPIKEY' />"; | |
message.innerHTML+="<p>Longitude: " + location.coords.longitude + "</p>"; | |
message.innerHTML+="<p>Latitude: " + location.coords.latitude + "</p>"; | |
message.innerHTML+="<p>Accuracy: " + location.coords.accuracy + "</p>"; | |
} | |
navigator.geolocation.getCurrentPosition(handler); | |
</script> | |
</head> | |
<body> | |
<div id="message">Location unknown</div> | |
</body> | |
</html><?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>iPhone 3.0 geolocation demo</title> | |
<meta content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" name="viewport"/> | |
<script> | |
function handler(location) { | |
var message = document.getElementById("message"); | |
message.innerHTML ="<img src='http://maps.google.com/staticmap?center=" + location.coords.latitude + "," + location.coords.longitude + "&size=300x200&maptype=hybrid&zoom=16&key=YOURGOOGLEAPIKEY' />"; | |
message.innerHTML+="<p>Longitude: " + location.coords.longitude + "</p>"; | |
message.innerHTML+="<p>Latitude: " + location.coords.latitude + "</p>"; | |
message.innerHTML+="<p>Accuracy: " + location.coords.accuracy + "</p>"; | |
} | |
navigator.geolocation.getCurrentPosition(handler); | |
</script> | |
</head> | |
<body> | |
<div id="message">Location unknown</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment