Dreamweaver

webwil42 -  
-mk- Messages postés 421 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

Ma question concerne la finalisation d'un site internet, je voudrais creer deux site une version web et une version smartphone, ma question est simple comment faire pour que lorsque l'on regarde le site sur un smartphone il nous demande si l'on veux regarder la version web ou la version smrtphone.

Merci d'avance

Dreamwaever Cs5 , Win 7

3 réponses

-mk- Messages postés 421 Date d'inscription   Statut Membre Dernière intervention   94
 
Un script en PHP suffit amplement.

Celui-ci vérifiera le User Agent du navigateur et pourra savoir s'il s'agit d'un smartphone ou d'un ordinateur.
La redirection se fait en fonction du résultat.

Je t'ai mis plusieurs conditions afin que tu puisse garder celle qui te plait :
<?php
$useragent = $_SERVER["HTTP_USER_AGENT"];

if (preg_match("(DoCoMo/1.0|DoCoMo/2.0|portalmmm/1.0|portalmmm/2.0|ACER|Alcatel|AnnyWay|AUDIOVOX|BlackBerry|CDM|Ericsson|LG\b|LGE|Motorola|MOT-|NEC|Nokia|Panasonic|QCI|SAGEM|SAMSUNG|SEC-|Sanyo|Sendo|SHARP|SIE-|SonyEricsson|Telit|Telit_Mobile_Terminals|TSM)",$useragent)){
	header("location:LIENVERSIONSMARTPHONE");
	exit();
} else if (preg_match("(PluckerPalm|RegKing|EPOC|PalmOS|KDDI|EZOS|Zaurus C750|SPV C500|hspr-H102|UPG1|Wapagsim|J-PHONEKGT/|UP.Link|Symbian)",$useragent)){
	header("location:LIENVERSIONSMARTPHONE");
	exit();
} else if (preg_match("(240x320|160x160|176x220|320x320|480x640)",$useragent)){
	header("location:LIENVERSIONSMARTPHONE");
	exit();
} else if (preg_match("(AvantGo 3.2|EudoraWeb 2.1|UP.Browser|Plucker|PalmSource|NetFront/3.0|Xiino/1.0.9E|Elaine/3.0|Pixo-Browser)",$useragent)){
	header("location:LIENVERSIONSMARTPHONE");
	exit();
} else {
	header("location:LIENORDINATEUR");
	exit();
}
?>
0
webwil42
 
Merci de ta reponse mk
0
-mk- Messages postés 421 Date d'inscription   Statut Membre Dernière intervention   94
 
Pas de soucis.
Marque juste ce post comme étant résolu.
0