1 の場合(/(iPhone |アプリ| iPodの| iOS版)/ i.test(navigator.userAgent)){ 2 3 // 警告(navigator.userAgent)。 4 window.location.href = "iPhone.html" 。 5 6 } そう であれば(/(アンドロイド)/ i.test(navigator.userAgent)){ 7 8 // 警告(navigator.userAgent)。 9 window.location.href = "Android.html" 。 10 11 } 他{ 12 13 window.location.href = "pc.html" 。 14 15 }。 16 17 もし(Windowsの携帯電話)/ | iOSの| |アンドロイド/(iPhone i.test(navigator.userAgent)){ 18 window.location.href = 'mobile.html' ; 19 }
1つの VAR UA = navigator.userAgent.toLowerCase()。 2 VaRのドライブ。 3 であれば(/ iPhone |アプリ|のiPod / .TEST(UA)){ 4 = 1ドライブ。 5 } そう であれば(/アンドロイド/ .TEST(UA)){ 6 ドライブ= 3 。 7 }