Détecter iPhone / iTouch en javascript
Voici une news brève mais utile pour les développeurs web, qui veulent rediriger leurs visiteurs ayant un iPhone vers un site adapté à l'appareil.
Une petite fonction javascript comme celle ci vous aidera, par exemple dans ce cas à rediriger directement vers le site version mobile :
function iPhoneDetect() {
if((navigator.userAgent.match(/iPhone/i))||(navigator.userAgent.match(/iPod/i))){
window.location.href = "http://iphone.site.com";
}
}
Développement - #216
- rss coms
-
dimanche 08 fév 2009 à 20h00 par






Commentaires
1. dimanche 08 fév 2009 à 20h02 : eMarto Répondre
2. dimanche 08 fév 2009 à 20h52 : Coco Répondre
3. lundi 09 fév 2009 à 00h08 : Alibab8 Répondre
4. lundi 09 fév 2009 à 13h52 : mounir Répondre
5. lundi 09 fév 2009 à 21h17 : Medhi Naitmazi Répondre
6. mardi 01 dec 2009 à 15h48 : nizar Répondre
7. jeudi 11 mar 2010 à 15h08 : Juzinho Répondre
8. mercredi 13 juil 2011 à 01h17 : Yannick Répondre
Ajouter un commentaire