我使用Typekit.com在网站上显示cufonts,但是,它只与移动浏览器 = 4.2 iOS兼容.我已经使用jQuery来测试访问者是否正在使用iOS并根据过去的情况显示特定内容(没有汗水),但我在查明如何更具体并
演示:http://jsfiddle.net/ThinkingStiff/LJrEW/
脚本:
var style = '';
if( getOsVersion() >= 4.2 ) {
style = '<link rel="stylesheet" href="styles/ios.css" />';
} else {
style = '<link rel="stylesheet" href="styles/ios_old.css" />';
};
document.head.insertAdjacentHTML( 'beforeEnd', style );
function getOsVersion() {
var agent = window.navigator.userAgent,
start = agent.indexOf( 'OS ' );
if ( /iphone|ipod|ipad/.test( agent ) && start > -1 ) {
return window.Number( agent.substr( start + 3, 3 ).replace( '_', '.' ) );
} else {
return 0;
};
};
