다음 코드는 검색 엔진에 적절한 콘텐츠를 표시하기 위한 것이지만 SEO에는 좋지 않습니다. 권장되지 않습니다. 학습 참고 자료로.
다음과 같이 코드를 복사합니다.<%
function GetBot()
'Query spider
Dim s_agent
GetBot=
s_agent=Request.ServerVariables(HTTP_USER_AGENT) '주요 판단문
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 then
GetBot=Sohu
end if
instr(1,s_agent,lycos,1) >0 then
GetBot=Lycos
end if
if instr(1,s_agent,robozilla,1) >0 then
GetBot=Robozilla
end if
end function
if GetBot=baidu then
'Baidu에 맞게 맞춤설정된 콘텐츠
elseif GetBot=google then
'Google에 맞춤설정된 콘텐츠
end if
%>
다음은 더 완전한 친구입니다. 코드가 필요한 사람도 참조할 수 있습니다. 또한 일부 클라이언트 정보도 포함됩니다.
다음과 같이 코드를 복사합니다.
Class SystemInfo_Cls
Public Browser, version, platform, IsSearch, AlexaToolbar
Private Sub Class_Initialize()
Dim Agent, Tmpstr
IsSearch = False
If Not IsEmpty(Session(SystemInfo_Cls)) Then
Tmpstr = Split(Session(SystemInfo_Cls), | | |)
브라우저 = Tmpstr(0)
버전 = Tmpstr(1)
플랫폼 = Tmpstr(2)
AlexaToolbar = Tmpstr(4)
If Tmpstr(3) = 1 Then
IsSearch = True
End If
Exit Sub
End If
Browser = 알 수 없는
버전 = 알 수 없는
플랫폼 = 알 수 없음
Agent = Request.ServerVariables(HTTP_USER_AGENT)
If InStr(Agent, Alexa Toolbar) > 0 Then
AlexaToolbar = YES
Else
AlexaToolbar = NO
End If
If Left(에이전트, 7) = Mozilla Then '브라우저에 대한 식별자는 다음과 같습니다.
Agent = Split(Agent, ;)
If InStr(Agent(1), MSIE) > 0 Then
Browser = Internet Explorer
버전 = Trim(Left(Replace(Agent(1), MSIE, ) , 6))
ElseIf InStr(Agent(4), Netscape) > 0 Then
Browser = Netscape
Tmpstr = Split(Agent(4), /)
version = Tmpstr(UBound(Tmpstr))
ElseIf InStr(Agent(4), rv:) > 0 Then
Browser = Mozilla
Tmpstr = Split(Agent(4), :)
version = Tmpstr(UBound(Tmpstr))
If InStr(version, ) ) > 0 Then
Tmpstr = Split(version, ))
version = Tmpstr(0)
End If
End If
If InStr(Agent(2), NT 5.2) > 0 그러면
플랫폼 = Windows 2003
ElseIf InStr(Agent(2), Windows CE) > 0 그러면
플랫폼 = Windows CE
ElseIf InStr(Agent(2), NT 5.1) > 0 그러면
플랫폼 = Windows XP
ElseIf InStr(Agent( 2), NT 4.0) > 0 그러면
플랫폼 = Windows NT
ElseIf InStr(Agent(2), NT 5.0) > 0 그러면
플랫폼 = Windows 2000
ElseIf InStr(Agent(2), NT) > 0 그러면
플랫폼 = Windows NT
ElseIf InStr(Agent(2), 9x) > 0 그러면
플랫폼 = Windows ME
ElseIf InStr(Agent(2), 98) > 0 그러면
플랫폼 = Windows 98
ElseIf InStr(Agent(2), 95) > 0 그러면
플랫폼 = Windows 95
ElseIf InStr(Agent(2), Win32) > 0 그러면
플랫폼 = Win32
ElseIf InStr(Agent(2), Linux) > 0 그러면
플랫폼 = Linux
ElseIf InStr(Agent(2), SunOS) > 0 그러면
플랫폼 = SunOS
ElseIf InStr( Agent(2), Mac) > 0 그러면
플랫폼 = Mac
ElseIf UBound(Agent) > 2 그러면
If InStr(Agent(3), NT 5.1) > 0 그러면
플랫폼 = Windows XP
End If If
If InStr(Agent(3), Linux) > 0 그러면
플랫폼 = Linux
End If
End If
If InStr(Agent(2), Windows) > 0 그리고 플랫폼 = 알 수 없음 그러면
플랫폼 = Windows
End If
ElseIf Left(Agent, 5) = Opera Then '브라우저에 대한 식별자가 있습니다.
Agent = Split(Agent, /)
Browser = Mozilla
Tmpstr = Split(Agent(1), )
version = Tmpstr(0)
If InStr(Agent(1), NT 5.2) > 0 그러면
플랫폼 = Windows 2003
ElseIf InStr(Agent(1), Windows CE) > 0 그러면
플랫폼 = Windows CE
ElseIf InStr(Agent(1), NT 5.1 ) > 0 그러면
플랫폼 = Windows XP
ElseIf InStr(Agent(1), NT 4.0) > 0 그러면
플랫폼 = Windows NT
ElseIf InStr(Agent(1), NT 5.0) > 0 그러면
플랫폼 = Windows 2000
ElseIf InStr(Agent(1), NT) > 0 그러면
플랫폼 = Windows NT
ElseIf InStr(Agent(1), 9x) > 0 그러면
플랫폼 = Windows ME
ElseIf InStr(Agent(1), 98) > 0 그러면
플랫폼 = Windows 98
ElseIf InStr(Agent(1), 95) > 0 그러면
플랫폼 = Windows 95
ElseIf InStr(Agent(1), Win32) > 0 그러면
플랫폼 = Win32
ElseIf InStr(Agent(1), Linux) > 0 그러면
플랫폼 = Linux
ElseIf InStr(Agent(1), SunOS) > 0 그러면
플랫폼 = SunOS
ElseIf InStr(Agent(1), Mac) > 0 그러면
플랫폼 = Mac
ElseIf UBound(Agent) > 2 그러면
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
'검색 엔진 식별
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)
InStr(Agent, botlist(i)) > 0이면
플랫폼 = botlist(i) & SearcherIsSearch
= True
Exit For
End If
Next If
IsSearch
Then
Browser =
version =
Session(SystemInfo_Cls) = Browser & ||| & 버전 & ||| & 플랫폼 & |||
1
|||
)=
브라우저 & ||| & 버전 & |||&
플랫폼
& |||0|||