Tenga en cuenta que el siguiente código está destinado a mostrar contenido apropiado para los motores de búsqueda, pero esto no es bueno para el SEO. No recomendado. Como referencia de aprendizaje.
Copie el código de la siguiente manera:<%
function GetBot()
'Query spider
dim s_agent
GetBot=
s_agent=Request.ServerVariables(HTTP_USER_AGENT) 'Declaración de juicio clave
si instr(1,s_agent,googlebot,1) >0 entonces
GetBot=google
end if
si instr(1,s_agent,msnbot,1) >0 entonces
GetBot=MSN
finaliza si
si instr(1,s_agent,slurp,1) >0 entonces
GetBot=Yahoo
finaliza
si instr(1,s_agent,baiduspider,1) >0 entonces
GetBot=baidu
finaliza
si instr(1,s_agent,sohu-search,1) >0 entonces
GetBot=Sohu
finaliza
si instr(1,s_agent,lycos,1) >0 entonces
GetBot=Lycos
finaliza si
si instr(1,s_agent,robozilla,1) >0 entonces
GetBot=Robozilla
finaliza si
finaliza la función
si GetBot=baidu entonces
'Contenido personalizado para Baidu
elseif GetBot=google luego
'Contenido personalizado para Google
finaliza si
%>
Lo siguiente es más completo Amigos Quienes necesiten el código también pueden consultarlo. También incluye cierta información del cliente.
Copie el código de la siguiente manera:
Class SystemInfo_Cls
Navegador público, versión, plataforma, IsSearch, AlexaToolbar
Private Sub Class_Initialize()
Dim Agent, Tmpstr
IsSearch = False
If Not IsEmpty(Session(SystemInfo_Cls)) Then
Tmpstr = Split(Session(SystemInfo_Cls), | | |)
Navegador = Tmpstr(0)
versión = Tmpstr(1)
plataforma = Tmpstr(2)
AlexaToolbar = Tmpstr(4)
Si Tmpstr(3) = 1 Entonces
IsSearch = Verdadero
Fin Si
Salir Sub
Fin Si
Navegador =
versión desconocida =
plataforma desconocida = desconocido
Agente = Request.ServerVariables(HTTP_USER_AGENT)
Si InStr(Agente, Alexa Barra de herramientas) > 0 Entonces
AlexaToolbar = SÍ
De lo contrario
AlexaToolbar = NO
Finalizar si
queda (Agente, 7) = Mozilla Entonces 'Existe este identificador para el navegador
Agente = Split(Agente, ;)
Si InStr(Agente(1), MSIE) > 0 Entonces
Navegador =
Versión de Internet Explorer = Trim(Left(Replace(Agente(1), MSIE, ) , 6))
ElseIf InStr(Agente(4), Netscape) > 0 Entonces
Navegador = Netscape
Tmpstr = Split(Agente(4), /)
versión = Tmpstr(UBound(Tmpstr))
ElseIf InStr(Agent(4), rv:) > 0 Entonces
Navegador = Mozilla
Tmpstr = Split(Agent(4), :)
versión = Tmpstr(UBound(Tmpstr))
If InStr(version, ) ) > 0 Entonces
Tmpstr = Split(versión, ))
versión = Tmpstr(0)
Fin Si
Fin Si
Si InStr(Agente(2), NT 5.2) > 0 Entonces
plataforma = Windows 2003
ElseIf InStr(Agente(2), Windows CE) > 0 Entonces
plataforma = Windows CE
ElseIf InStr(Agente(2), NT 5.1) > 0 Entonces
plataforma = Windows XP
ElseIf InStr(Agente( 2), NT 4.0) > 0 Entonces
plataforma = Windows NT
ElseIf InStr(Agent(2), NT 5.0) > 0 Entonces
plataforma = Windows 2000
ElseIf InStr(Agente(2), NT) > 0 Entonces
plataforma = Windows NT
ElseIf InStr(Agente(2), 9x) > 0 Entonces
plataforma = Windows ME
ElseIf InStr(Agente(2), 98) > 0 Entonces
plataforma = Windows 98
ElseIf InStr(Agent(2), 95) > 0 Entonces
plataforma = Windows 95
ElseIf InStr(Agente(2), Win32) > 0 Entonces
plataforma = Win32
ElseIf InStr(Agente(2), Linux) > 0 Entonces
plataforma = Linux
ElseIf InStr(Agente(2), SunOS) > 0 Entonces
plataforma = SunOS
ElseIf InStr( Agente(2), Mac) > 0 Entonces
plataforma = Mac
ElseIf UBound(Agente) > 2 Entonces
si InStr(Agente(3), NT 5.1) > 0 Entonces
plataforma = Windows XP
End If
If InStr(Agent(3), Linux) > 0 Then
plataforma = Linux
End If
End If
If InStr(Agent(2), Windows) > 0 Y plataforma = desconocido Entonces
plataforma = Windows
End If
ElseIf Left(Agent, 5) = Opera Then 'Existe este identificador para el navegador
Agent = Split(Agent, /)
Browser = Mozilla
Tmpstr = Split(Agent(1), )
versión = Tmpstr(0)
Si InStr(Agente(1), NT 5.2) > 0 Entonces
plataforma = Windows 2003
De lo contrarioInStr(Agente(1), Windows CE) > 0 Entonces
plataforma = Windows CE
De lo contrario InStr(Agente(1), NT 5.1 ) > 0 Entonces
plataforma = Windows XP
ElseIf InStr(Agent(1), NT 4.0) > 0 Entonces
plataforma = Windows NT
ElseIf InStr(Agente(1), NT 5.0) > 0 Entonces
plataforma = Windows 2000
Si no InStr(Agente(1), NT) > 0 Entonces
plataforma = Windows NT
Si no InStr(Agente(1), 9x) > 0 Entonces
plataforma = Windows ME
ElseIf InStr(Agente(1), 98) > 0 Entonces
plataforma = Windows 98
ElseIf InStr(Agente(1), 95) > 0 Entonces
plataforma = Windows 95
ElseIf InStr(Agente(1), Win32) > 0 Entonces
plataforma = Win32
ElseIf InStr(Agente(1), Linux) > 0 Entonces
plataforma = Linux
ElseIf InStr(Agente(1), SunOS) > 0 Entonces
plataforma = SunOS
ElseIf InStr(Agente(1), Mac) > 0 Entonces
plataforma = Mac
ElseIf UBound(Agente) > 2 Entonces
si InStr(Agent(3), NT 5.1) > 0 Then
plataforma = Windows XP
End If
If InStr(Agent(3), Linux) > 0 Then
plataforma = Linux
End If
End If
Else
'Identificar motor de búsqueda
Dim botlist, i
botlist = Google,Isaac,Webdup,SurveyBot,Baiduspider,ia_archiver,P.Arthur,FAST-WebCrawler,Java,Microsoft-ATL-Native,TurnitinBot,WebGather,Sleipnir
botlist = Split(botlist, ,)
For i = 0 To UBound(botlist)
Si InStr(Agente, lista de bots(i)) > 0 Entonces
plataforma = lista de bots(i) & SearcherIsSearch
= True
Salir para
Fin Si
Siguiente
Fin Si
Si IsSearch Entonces
Navegador =
versión =
Sesión(SystemInfo_Cls) = Navegador & ||| & versión & ||| & plataforma & |||& AlexaToolbar
Else
Session (SystemInfo_Cls)
)
=
Navegador y ||| yversión
y ||| y plataforma y |||0|||