begin process at 2012 05 28 11:13:37
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Navigation

 > MAMMOUTH : AFFECTATION INDIVIDUELLE

MAMMOUTH : AFFECTATION INDIVIDUELLE


 Information sur la source

 Description

Vous aurez sans cesse à tenir compte de différents navigateurs, versions variées, ...
Plutôt ke de faire un ribanabelle (je sais pas si ça s'écrit comme ça !!) de page, il vaut mieux ne créer qu'une seule page, et l'adapter aux spécificité du visiteurs.

Source

  • <html>
  • <head>
  • <title>Mammouth : affectation individuelle</title>
  • <script language="JavaScript"><!--
  • // Détermination de la version du navigateur
  • var browser = new Object();
  • var agent = navigator.userAgent.toLowerCase();
  • browser.major = parseInt(navigator.appVersion);
  • browser.minor = parseFloat(navigator.appVersion);
  • browser.nav = ( (agent.indexOf('mozilla') != -1 )
  • && (agent.indexOf('opera') == -1)
  • && (agent.indexOf('compatible') == -1) );
  • browser.nav2 = (browser.nav && (browser.major >= 2));
  • browser.nav3 = (browser.nav && (browser.major >= 3));
  • browser.nav4 = (browser.nav && (browser.major >= 4));
  • browser.ie = (agent.indexOf("msie") != -1);
  • browser.ie3 = (browser.ie && (browser.major == 2));
  • browser.ie4 = (browser.ie && (browser.major >= 4));
  • browser.op = (agent.indexOf("opera") != -1);
  • browser.unix = (agent.indexOf("x11") != -1);
  • browser.win = (agent.indexOf("win") != -1);
  • browser.mac = (agent.indexOf("mac") != -1);
  • browser.lowres = (screen.width < 800);
  • browser.medres = (screen.width == 800);
  • browser.highres = (screen.width > 800);
  • //--></script>
  • </head>
  • <body bgcolor=#ffffff text=#aaaaaa link=#aaaaaa vlink=#aaaaaa alink=#ff0000>
  • <font size=3 face="arial,helvetica" color=#ff0000>
  • Votre navigateur est...<br>
  • </font>
  • <p align=left>
  • <font size=2 face="arial,helvetica" color=#555555>
  • <script language="JavaScript"><!--
  • if(browser.nav3)
  • {
  • document.write('Netscape Navigator 3 ou plus<br>\n');
  • } else
  • if(browser.ie4) {
  • document.write('Internet Explorer 4 ou plus<br>\n');
  • } else
  • if(browser.op) {
  • document.write('Opera 3.6 ou plus<br>\n');
  • } else {
  • document.write('ni Netscape, ni Internet Explorer, ni Opera<br>\n');
  • }
  • if(browser.lowres)
  • {
  • document.write('Vous utilisez une résolution basse.');
  • } else
  • if(browser.medres)
  • {
  • document.write('Vous utilisez une résolution moyenne.');
  • } else
  • if(browser.highres)
  • {
  • document.write('Vous utilisez une résolution haute.');
  • }
  • // --></script>
  • </font>
  • </p>
  • </body>
  • </html>
<html>

<head>

  <title>Mammouth : affectation individuelle</title>

  <script language="JavaScript"><!--

    // Détermination de la version du navigateur
    var browser = new Object();
    var agent = navigator.userAgent.toLowerCase();
    browser.major = parseInt(navigator.appVersion);
    browser.minor = parseFloat(navigator.appVersion);
    browser.nav  = ( (agent.indexOf('mozilla') != -1 )
                  && (agent.indexOf('opera') == -1)
		  && (agent.indexOf('compatible') == -1) );
    browser.nav2 = (browser.nav && (browser.major >= 2));
    browser.nav3 = (browser.nav && (browser.major >= 3));
    browser.nav4 = (browser.nav && (browser.major >= 4));
    browser.ie   = (agent.indexOf("msie") != -1);
    browser.ie3  = (browser.ie && (browser.major == 2));
    browser.ie4  = (browser.ie && (browser.major >= 4));
    browser.op   = (agent.indexOf("opera") != -1);
    browser.unix = (agent.indexOf("x11") != -1);
    browser.win  = (agent.indexOf("win") != -1);
    browser.mac  = (agent.indexOf("mac") != -1);
    browser.lowres = (screen.width < 800);
    browser.medres = (screen.width == 800);
    browser.highres = (screen.width > 800);

  //--></script>

</head>


<body bgcolor=#ffffff text=#aaaaaa link=#aaaaaa vlink=#aaaaaa alink=#ff0000>

<font size=3 face="arial,helvetica" color=#ff0000>
Votre navigateur est...<br>
</font>

<p align=left>
<font size=2 face="arial,helvetica" color=#555555>

<script language="JavaScript"><!--

  if(browser.nav3)
  {
    document.write('Netscape Navigator 3 ou plus<br>\n');
  } else
  if(browser.ie4) {
    document.write('Internet Explorer 4 ou plus<br>\n');
  } else
  if(browser.op) {
    document.write('Opera 3.6 ou plus<br>\n');
  } else {
    document.write('ni Netscape, ni Internet Explorer, ni Opera<br>\n');
  }

  if(browser.lowres)
  {
    document.write('Vous utilisez une résolution basse.');
  } else
  if(browser.medres)
  {
    document.write('Vous utilisez une résolution moyenne.');
  } else
  if(browser.highres)
  {
    document.write('Vous utilisez une résolution haute.');
  }
    
// --></script>

</font>
</p>

</body>

</html>
 

 Conclusion

Essayer, expérimentez, testez les requètes if pour aborder les multiples possibilités.


 Sources du même auteur

EVENT HANDLER (INFO-AIDE FORMULAIRE + QQS FONCTIONS)
FRACTALE MANDLEBROT (GÉNÉRER EN JS AVEC BOUCLE FOR..)
POPUP QUI AFFICHE LE TEMPS DE CONNECTION SUR UNE PAGE ;)
INFOBULLE SOUS IE ET/OU NETSCAPE
DESSINER UN HISTOGRAMME (DYNAMIQUEMENT ! :)

 Sources de la même categorie

Source avec Zip Source avec une capture ANTI-ROBOTS V 1.0 par MacGaliver
Source avec une capture PRÉSENTOIR PAGE/SUJET par tiranus
Source avec Zip Source avec une capture NAVIGATEUR INTERNET HAVRET par HAVRETos
Source avec Zip WMANAGER.JS : GÉRER LES FICHIERS WMA AVEC WINDOWS MEDIA PLAY... par jdmcreator
Source avec Zip Source avec une capture NAVIGATION PAR AJAX, CHARGEMENT DES PAGES SANS RECHARGEMENT par zulrigh

Commentaires et avis

Commentaire de EmirNilbru le 08/08/2005 18:42:52

Excuse moi, mais je ne vois pas trop à quoi ca sert. Je ne voit pas l'avantage par rapport à un sript de redir. Sauf que ici, tu vas tou mettre dans la meme page, donc elle va être plus lourde au chargement..
Est ce que c'est mieux que d'avoir une redir???
Ou bien je n'ai rien compris, explique moi stp, merci d'avance

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 1,747 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales