Quote:
Originally Posted by lorax
I am hoping to be able to implement the Core Location solution in my iPhone optimized web page so that paramedics can click on a link next to a hospital's name and get directions in Google Maps from their current location. How would I incorporate this as Javascript into the HTML; either inline or as part of an external javascript file?
Assistance on this would be greatly appreciated! The paramedics of Alameda County would be very thankful!!!!
-joshua the lorax
Test site link here
|
Joshua,
I don't know if you can directly get the current location from the phone in a dynamic web page. See discussion here:
iPhone app that access the Core Location framework over web - Stack Overflow
or
Accessing the iPhone Location from a Webpage [splitbrain.org]
That's one advantage of the SDK. It gives you access to stuff like that. But, if you can get the current location (using one of the two techniques linked to above, or some other way), then you can use a web page like this:
Code:
<html>
<head>
<meta name="viewport" content="width=320"/>
<script language="javascript" type="text/javascript">
<!--
function mapTo(address) {
// put something more sophisticated here, if you don't want to hard-code the start coordinates:
window.open('http://maps.google.com/maps?saddr=47.58012312,-122.3459&daddr=' + address);
}
-->
</script>
</head>
<body>
Click on <a href="http://maps.google.com/maps?saddr=47.57164,-122.4096&daddr=4916+Erskine+Way+SW,+Seattle,+WA,+98116"> this link</a> to open the Maps app.
<br/>
Or click on <a href="#" onClick="javascript:mapTo('5040+Erskine+Way+SW,+Seattle,+WA,+98116');return false" >a more dynamic map link here</a>.
</body>
</html>
I
put this page on my webserver, and tested it with my iPhone. Does this help?