Observe que o código a seguir tem como objetivo exibir algum conteúdo apropriado para mecanismos de pesquisa, mas isso não é bom para SEO. Não recomendado. Como referência de aprendizagem.
Copie o código da seguinte forma:<%
function GetBot()
'Query spider
dim s_agent
GetBot=
s_agent=Request.ServerVariables(HTTP_USER_AGENT) 'Declaração de julgamento chave
if instr(1,s_agent,googlebot,1) >0 then
GetBot=google
end if
if instr(1,s_agent,msnbot,1) >0 then
GetBot=MSN
end if
if instr(1,s_agent,slurp,1) >0 then
GetBot=Yahoo
end if
if instr(1,s_agent,baiduspider,1) >0 then
GetBot=baidu
end if
if instr(1,s_agent,sohu-search,1) >0 então
GetBot=Sohu
fim se
if instr(1,s_agent,lycos,1) >0 então
GetBot=Lycos
fim se
se instr(1,s_agent,robozilla,1) >0 then
GetBot=Robozilla
end if
end function
if GetBot=baidu then
'Conteúdo personalizado para Baidu
elseif GetBot=google then
'Conteúdo personalizado para Google
end if
%>
O seguinte é mais completo Amigos quem precisa do código também pode consultá-lo. Também inclui algumas informações do cliente.
Copie o código da seguinte forma:
Classe SystemInfo_Cls
Navegador público, versão, 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)
versão = Tmpstr(1)
plataforma = Tmpstr(2)
AlexaToolbar = Tmpstr(4)
If Tmpstr(3) = 1 Then
IsSearch = True
End If
Exit Sub
End If
Browser =
versão desconhecida =
plataforma desconhecida = desconhecido
Agent = Request.ServerVariables(HTTP_USER_AGENT)
If InStr(Agent, Alexa Barra de ferramentas) > 0 Então
AlexaToolbar = SIM
Else
AlexaToolbar = NÃO
End If
If Left(Agent, 7) = Mozilla Then 'Existe este identificador para o navegador
Agent = Split(Agent, ;)
If InStr(Agent(1), MSIE) > 0 Then
Browser = Internet Explorer
version = Trim(Left(Replace(Agent(1), MSIE, ) , 6))
ElseIf InStr(Agent(4), Netscape) > 0 Then
Browser = Netscape
Tmpstr = Split(Agent(4), /)
versão = Tmpstr(UBound(Tmpstr))
ElseIf InStr(Agent(4), rv:) > 0 Then
Navegador = Mozilla
Tmpstr = Split(Agent(4), :)
versão = Tmpstr(UBound(Tmpstr))
If InStr(versão, ) ) > 0 Then
Tmpstr = Split(versão, ))
versão = Tmpstr(0)
End If
End If
If InStr(Agent(2), NT 5.2) > 0 Then
plataforma = Windows 2003
ElseIf InStr(Agent(2), Windows CE) > 0 Then
plataforma = Windows CE
ElseIf InStr(Agent(2), NT 5.1) > 0 Then
plataforma = Windows XP
ElseIf InStr(Agent( 2), NT 4.0) > 0 Então
plataforma = Windows NT
ElseIf InStr(Agent(2), NT 5.0) > 0 Então
plataforma = Windows 2000
ElseIf InStr(Agent(2), NT) > 0 Then
plataforma = Windows NT
ElseIf InStr(Agent(2), 9x) > 0 Then
plataforma = Windows ME
ElseIf InStr(Agent(2), 98) > 0 Then
plataforma = Windows 98
ElseIf InStr(Agent(2), 95) > 0 Then
plataforma = Windows 95
ElseIf InStr(Agente(2), Win32) > 0 Então
plataforma = Win32
ElseIf InStr(Agente(2), Linux) > 0 Então
plataforma = Linux
ElseIf InStr(Agente(2), SunOS) > 0 Então
plataforma = SunOS
ElseIf InStr( Agente(2), Mac) > 0 Então
plataforma = Mac
ElseIf UBound(Agente) > 2 Então
If InStr(Agente(3), NT 5.1) > 0 Then
plataforma = Windows XP
End If
If InStr(Agent(3), Linux) > 0 Then
platform = Linux
End If
End If
If InStr(Agent(2), Windows) > 0 And platform = desconhecido Then
platform = Windows
End If
ElseIf Left(Agent, 5) = Opera Then 'Existe este identificador para o navegador
Agent = Split(Agent, /)
Browser = Mozilla
Tmpstr = Split(Agent(1), )
version = Tmpstr(0)
If InStr(Agente(1), NT 5.2) > 0 Então
plataforma = Windows 2003
ElseIf InStr(Agente(1), Windows CE) > 0 Então
plataforma = Windows CE
ElseIf InStr(Agente(1), NT 5.1 ) > 0 Then
plataforma = Windows XP
ElseIf InStr(Agent(1), NT 4.0) > 0 Then
plataforma = Windows NT
ElseIf InStr(Agent(1), NT 5.0) > 0 Then
plataforma = Windows 2000
ElseIf InStr(Agent(1), NT) > 0 Then
plataforma = Windows NT
ElseIf InStr(Agent(1), 9x) > 0 Then
plataforma = Windows ME
ElseIf InStr(Agente(1), 98) > 0 Então
plataforma = Windows 98
ElseIf InStr(Agente(1), 95) > 0 Then
plataforma = Windows 95
ElseIf InStr(Agent(1), Win32) > 0 Then
plataforma = Win32
ElseIf InStr(Agent(1), Linux) > 0 Then
plataforma = Linux
ElseIf InStr(Agent(1), SunOS) > 0 Then
plataforma = SunOS
ElseIf InStr(Agent(1), Mac) > 0 Then
plataforma = Mac
ElseIf UBound(Agent) > 2 Then
If InStr(Agent(3), NT 5.1) > 0 Then
platform = Windows XP
End If
If InStr(Agent(3), Linux) > 0 Then
platform = Linux
End If
End If
Else
'Identificar mecanismo de busca
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)
Se InStr(Agente, botlist(i)) > 0 Então
plataforma = botlist(i) & SearcherIsSearch
= True
Sair para
End If
Next
End If
If IsSearch Then
Browser =
version =
Session(SystemInfo_Cls) = Browser & ||| & version & ||| & platform & |||1||| & AlexaToolbar
Else
Session (SystemInfo_Cls ) = Navegador & ||| & versão & ||| & plataforma & |||0||| & AlexaToolbar
End If
End Sub
End Classe