Skip to content

Instantly share code, notes, and snippets.

@zerostyle
Created June 12, 2012 18:26
Show Gist options
  • Save zerostyle/2919218 to your computer and use it in GitHub Desktop.
Save zerostyle/2919218 to your computer and use it in GitHub Desktop.
Replace phone prefix
// Phone links
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:"));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment