Created
October 20, 2010 10:49
-
-
Save steffanwilliams/636181 to your computer and use it in GitHub Desktop.
TypeKit for iOS 4+
This file contains 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
var ua = navigator.userAgent; | |
var m = RegExp(/OS\s([\d+_?]*)\slike/i).exec(ua); | |
var version = m != null ? m[1].replace(/_/g, '.') : 4; | |
if (!(ua.match(RegExp('/ip(hone|ad|od)/i'))) || (ua.match(RegExp('/ip(hone|ad|od)/i')) && version >= 4)) { | |
try{Typekit.load();}catch(e){} | |
} |
This file contains 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
<?php | |
// Browsing sniffing for iOS devices less than 4, as they cannot support multiple font weights. | |
$agent = $_SERVER['HTTP_USER_AGENT']; | |
$version = preg_match('/OS\s([\d+_?]*)\slike/i', $agent, $matches); | |
$version = str_replace('_', '.', $matches[1]); | |
if (!(preg_match('/ip(hone|ad|od)/i', $agent)) || ((preg_match('/ip(hone|ad|od)/i', $agent) && $version >= 4))) { | |
echo '<script src="http://use.typekit.com/#TYPEKIT_CODE.js"></script>'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment