<% option explicit Response.Buffer = true Response.ContentType = "text/css" ' ' Leggo le assegnazioni di stile per tutti i browser ' response.write FileRead("common.css") ' ' Sniffo il browser ' select case BrowserSniff() case "n4" response.write FileRead("nn4x.css") case "e3", "e4", "e5", "e6" response.write FileRead("ie.css") case else response.write FileRead("notnn4x.css") End Select ' '-------------------------------------------------------------------------------------------- ' Funzione per identificare la versione del browser ' restituisce tramite i parametri di chiamata il produttore e la versione ' Restituisce una coppia di caratteri se è riuscito a determinare la versione, "" altrimenti ' Il primo carattere è: e explorer, n Netscape oppure Mozilla, o per Opera, c Chamaleon '-------------------------------------------------------------------------------------------- Function BrowserSniff() dim signature BrowserSniff = "" signature = Request.ServerVariables("HTTP_USER_AGENT") If InStr(signature, "MSIE") then BrowserSniff = "e" ' ' Explorer ' BrowserSniff = BrowserSniff & CInt(Mid(signature, InStr(signature, "MSIE") + 5, 1)) exit function End If If InStr(signature, "Mozilla") Then If InStr(signature, "compatible;") = 0 then BrowserSniff = "n" & CInt(Mid(signature, InStr(signature, "/") + 1, 1)) exit function End if End If If InStr(signature, "Opera") Then BrowserSniff = "o" & CInt(Mid(signature, InStr(signature, "/") + 1, 1)) exit function End If End function ' '-------------------------------------------------------------------------------------------- ' La funzione restituisce il contenuto di un file di testo il cui nome è passato come argomento '-------------------------------------------------------------------------------------------- ' Function FileRead(arg) dim objfso,objstream,ForReading ForReading = 1 set objfso = server.createObject("Scripting.FilesystemObject") if objfso.FileExists(server.MapPath(arg)) then set objstream = objfso.openTextFile(server.mappath(arg),ForReading) FileRead = objstream.ReadAll objstream.close set objstream = nothing Else FileRead = "

Si è verificato un errore Risulta inesistente un file componente del sito

" End If set objfso = nothing End Function %>