Visualizzazione dei risultati da 1 a 4 su 4

Discussione: Sniffing Safari

  1. #1

    Sniffing Safari

    Ciao a tutti

    qui di seguito vi riporto uno script che mi serve per differenziare il carattere di un sito a seconda del SO (windows o macos) e non solo, per quanto riguarda la versione mac voglio che venga applicato ai browser Safari e Internet Explore.

    Diciamo che lo script va... non funziona solo con Safari....sapete voi illuminarmi?


    <script language="JavaScript" type="text/javascript">
    <!--
    if (navigator.userAgent.toLowerCase().indexOf("win") > -1)
    {
    document.writeln("<style>");
    document.writeln("td {");
    document.writeln("font-family: Verdana, Arial, Helvetica, sans-serif;");
    document.writeln("font-size: 25px;");
    document.writeln("color: #FF0000;");
    document.writeln("}");
    document.writeln("</style>");
    }

    if (navigator.userAgent.toLowerCase().indexOf("mac") > -1)
    { if ((navigator.appName.indexOf("Safari") > -1) || (navigator.appName.indexOf("Internet Explorer") > -1))
    {
    document.writeln("<style>");
    document.writeln("td {");
    document.writeln("font-family: Verdana, Arial, Helvetica, sans-serif;");
    document.writeln("font-size: 12px;");
    document.writeln("color: #CCCCCC;");
    document.writeln("</style>");
    }
    }
    //-->
    </script>

  2. #2

  3. #3

  4. #4
    visto che non avete saputo aiutarmi (non per colpa vostra naturalmente) mi rispondo da solo così se a qualcuno interessa...

    if ( navigator.userAgent.indexOf("Mac") != -1 )
    {
    if ( ( navigator.appName.indexOf("Netscape") != -1 ) && ( parseFloat(navigator.appVersion) <= 4.7 ) )
    document.write("<link rel='stylesheet' href='stili_mac.css' type='text/css'>");
    if ( ( navigator.appName.indexOf("Netscape") != -1 ) && ( parseFloat(navigator.appVersion) > 4.7 ) )
    document.write("<link rel='stylesheet' href='stili_mac.css' type='text/css'>");
    if ( navigator.appVersion.indexOf("Explorer") != -1 )
    document.write("<link rel='stylesheet' href='stili_mac.css' type='text/css'>");
    if ( navigator.appVersion.indexOf("Safari") != -1 )
    document.write("<link rel='stylesheet' href='stili_mac.css' type='text/css'>");
    if ( ( navigator.appName.indexOf("Netscape") == -1 ) && ( navigator.appVersion.indexOf("Explorer") == -1 ) && ( navigator.appVersion.indexOf("Safari") == -1 ) )
    document.write("<link rel='stylesheet' href='stili_mac.css' type='text/css'>");
    }
    if ( navigator.userAgent.indexOf("Mac") == -1 )
    {
    if ( ( navigator.appName.indexOf("Netscape") != -1 ) && ( parseFloat(navigator.appVersion) <= 4.7 ) )
    document.write("<link rel='stylesheet' href='stili_win.css' type='text/css'>");
    if ( ( navigator.appName.indexOf("Netscape") != -1 ) && ( parseFloat(navigator.appVersion) > 4.7 ) )
    document.write("<link rel='stylesheet' href='stili_win.css' type='text/css'>");
    if ( navigator.appName.indexOf("Explorer") != -1 )
    document.write("<link rel='stylesheet' href='stili_win.css' type='text/css'>");
    if ( ( navigator.appName.indexOf("Netscape") == -1 ) && ( navigator.appVersion.indexOf("Explorer") == -1 ) )
    document.write("<link rel='stylesheet' href='stili_win.css' type='text/css'>");
    }




Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.