這裡提供一些javascript偵測程式碼,用來偵測iPhone、iPod、iPad設備。
Apple.Types = ["iPhone", "iPod", "iPad"];
for (var d = 0; d var t = Apple.Types[d];
Apple[t] = !!Apple.UA.match( new RegExp(t, “i”));
}
// is this an Apple device?
alert(
“Apple device? ” Apple.Device
“
iPhone? ” Apple.iPhone
“
iPod? ” Apple.iPod
“
iPad? ” Apple.iPad