Created
June 12, 2012 18:26
-
-
Save zerostyle/2919218 to your computer and use it in GitHub Desktop.
Replace phone prefix
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
// 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