Swappable callto: and tel: for Skype & iPhone
Filed Under:
Marking up a telephone number to use Skype’s callto: except when User Agent is iPhone uses tel:.
Javascript
<script language="javascript"> window.onload = function () { if (navigator.userAgent.match (/iPhone/i)) { var a = document.getElementsByTagName ("a"); for (var i = 0; i < a.length; i++) { if (a[i].getAttribute ('href').search (/callto:/i) === 0) { a[i].setAttribute ('href', a[i].getAttribute ('href').replace (/^callto:/, "tel:")); } } } }; </script>
The precending chunk of Javascript in the head of a document will swap out callto: for tel: in the following HTML.
HTML
<a href="callto:15035555555">+1 (503) 555 5555</a>
This leaves you with a hyper-linked phone number which depends on the user to have Skype installed on their machine so if you’d prefer to not confuse those without Skype by tempting them to click the number then you might stick a Skype icon along side the link.
User Agents other than iPhone will recognize the tel: protocol so the Javascript above could be expanded to involve more User Agents.
iPhone WebClip Bookmark Icon
Filed Under:
A 59 × 59 pixel png with transparency. Uploaded to site root.
Don’t need to reference the WebClip Bookmark Icon in the html because apparently Mobile Safari just picks up on it as it scans your root the pesky little critter.
Can put up reference to Icon in head which is useful if it is stored somewhere else.


