KmlLayer phone number clickable on mobile phone?

202 views
Skip to first unread message

offroad_bis

unread,
Aug 24, 2011, 9:21:02 PM8/24/11
to google-map...@googlegroups.com
Is there anyway to make a phone number linkable from a description of a Placemark delivered as a KML layer?  It would be nice if mobile phones could click on and dial the phone number.  It looks like the anchor tag is being converted to <a target="_blank">555-555-5555</a> when it starts out as <a href="tel:5555555555">555-555-5555</a>.  A sample of my kml is included below.

<?xml version="1.0" encoding="utf-8"?>
<Document>
<name>ndfu_coop.kml</name>
<Placemark>
<name>PLAINS COOPERATIVE</name>
<description><![CDATA[151 9TH AVE NW<br>SOME CITY, TX 55555<br><a href='tel:5555555555 rel='nofollow'>555-555-5555</a><br><a href='http://www.plains.coop.junk'>www.plains.coop.junk</a><br>]]></description>
<Point><coordinates>-98.014949681769124,46.923007754171174</coordinates></Point>
</Placemark>
</Document>
</kml>

The description div in the info box on the map formats the above kml as follows.
<div>151 9TH AVE NW<br>SOME CITY, TX 55555<br><a target="_blank">555-555-55552</a><br><a href="http://www.plains.coop.junk" target="_blank">www.plains.coop.junk</a><br></div>

Is it possible to keep the phone link? Any insight would be appreciated.


Thanks,

Rossko

unread,
Aug 25, 2011, 6:48:58 AM8/25/11
to Google Maps JavaScript API v3
> Is there anyway to make a phone number linkable from a description of a
> Placemark delivered as a KML layer?  It would be nice if mobile phones could
> click on and dial the phone number.  It looks like the anchor tag is being
> converted to <a target="_blank">555-555-5555</a> when it starts out as <a
> href="tel:5555555555">555-555-5555</a>.

This looks helpful to circumvent KmlLayer's laundering of content
http://groups.google.com/group/google-maps-js-api-v3/tree/browse_frm/thread/4b7740da55429f90

JFrancis

unread,
Aug 25, 2011, 9:43:31 AM8/25/11
to google-map...@googlegroups.com
I was noticing the same issue while developing a mobile version of our outages map. The iPhone and Android devices "helpfully" wrap telephone numbers displayed on a page in code to trigger the dialing function of the phone, but do nothing for telephone numbers that appear in Google Maps Info Windows. A little digging led me to this:

Using mobile-specific HTML, CSS, and JavaScript (Mobile web part 5)
http://davidbcalhoun.com/2010/using-mobile-specific-html-css-javascript

In it, the author describes two additional schemes for hyperlinks, tel and sms. An example would be <a href="tel:18005555555">Call us at 1-800-555-5555</a>

I currently have it working in a simple Info Window (not populated via KML) on both iPhone and Android devices; I suspect the KML could be sufficiently crafted to get it working in its Info Window as well.

JF
Reply all
Reply to author
Forward
0 new messages