ClassicASP 브라우저의 종류와 버전, OS 알아내기
페이지 정보
본문
<%
Dim hpStrUserAgent,hpAgentDevice,hpSwfCheck
'Request.ServerVariables("HTTP_USER_AGENT") ' 접속자의 에이젼트 정보를 얻는함수
hpStrUserAgent = Request.ServerVariables("HTTP_USER_AGENT")
'if request.ServerVariables("REMOTE_ADDR") = "내컴퓨터아이피" then ?' 내컴퓨터아이피찾기 ?http://ipconfig.co.kr
' response.write "hpStrUserAgent = "& hpStrUserAgent &"<br>"
'end if
If InStr(hpStrUserAgent,"Edge") > 0 then
hpAgentBrowser = "Edge"
elseIf InStr(hpStrUserAgent,"rv:11.0") > 0 then
hpAgentBrowser = "IE11"
elseIf InStr(hpStrUserAgent,"MSIE 10") > 0 then
hpAgentBrowser = "IE10"
elseIf InStr(hpStrUserAgent,"MSIE 9") > 0 then
hpAgentBrowser = "IE9"
elseIf InStr(hpStrUserAgent,"MSIE 8") > 0 then
hpAgentBrowser = "IE8"
elseIf InStr(hpStrUserAgent,"MSIE 7") > 0 then
hpAgentBrowser = "IE7"
elseIf InStr(hpStrUserAgent,"MSIE 6") > 0 then
hpAgentBrowser = "IE6"
elseIf InStr(hpStrUserAgent,"Opera") > 0 or InStr(hpStrUserAgent,"OPERA") > 0 or InStr(hpStrUserAgent,"OPR") > 0 then
hpAgentBrowser = "Opera"
elseIf InStr(hpStrUserAgent,"Firefox") > 0 or InStr(hpStrUserAgent,"FIREFOX") > 0 then
hpAgentBrowser = "Firefox"
elseIf InStr(hpStrUserAgent,"KAKAOTALK") > 0 then
hpAgentBrowser = "KakaoTalk"
elseIf InStr(hpStrUserAgent,"NAVER") > 0 then
hpAgentBrowser = "Naver"
elseIf InStr(hpStrUserAgent,"FBAN") > 0 or InStr(hpStrUserAgent,"FBAV") > 0 or InStr(hpStrUserAgent,"FBBV") > 0 or InStr(hpStrUserAgent,"FBRV") > 0 or InStr(hpStrUserAgent,"FBDV") > 0 or InStr(hpStrUserAgent,"FBMD") > 0 or InStr(hpStrUserAgent,"FBSN") > 0 or InStr(hpStrUserAgent,"FBSV") > 0 or InStr(hpStrUserAgent,"FBSS") > 0 or InStr(hpStrUserAgent,"FBCR") > 0 or InStr(hpStrUserAgent,"FBID") > 0 or InStr(hpStrUserAgent,"FBLC") > 0 or InStr(hpStrUserAgent,"FBOP") > 0 then
hpAgentBrowser = "Facebook"
elseIf InStr(hpStrUserAgent,"Chrome") > 0 or InStr(hpStrUserAgent,"CriOS") > 0 then
hpAgentBrowser = "Chrome"
elseIf InStr(hpStrUserAgent,"Android") > 0 or InStr(hpStrUserAgent,"ANDROID") > 0 then
hpAgentBrowser = "Android"
elseIf InStr(hpStrUserAgent,"Safari") > 0 or InStr(hpStrUserAgent,"SAFARI") > 0 then
hpAgentBrowser = "Safari"
else
hpAgentBrowser = "ETC"
end if
If InStr(hpStrUserAgent,"Android") > 0 then
hpAgentDevice = "Android"
elseIf InStr(hpStrUserAgent,"iPhone") > 0 then
hpAgentDevice = "iPhone"
elseIf InStr(hpStrUserAgent,"iPad") > 0 then
hpAgentDevice = "iPad"
elseIf InStr(hpStrUserAgent,"iPod") > 0 then
hpAgentDevice = "iPod"
elseIf InStr(hpStrUserAgent,"Macintosh") > 0 then
hpAgentDevice = "Macintosh"
elseIf InStr(hpStrUserAgent,"SymbianOS") > 0 then
hpAgentDevice = "SymbianOS"
elseIf InStr(hpStrUserAgent,"BlackBerry") > 0 then
hpAgentDevice = "BlackBerry"
elseIf InStr(hpStrUserAgent,"BB10") > 0 then
hpAgentDevice = "BB10"
elseIf InStr(hpStrUserAgent,"Nokia") > 0 then
hpAgentDevice = "Nokia"
elseIf InStr(hpStrUserAgent,"SonyEricsson") > 0 then
hpAgentDevice = "SonyEricsson"
elseIf InStr(hpStrUserAgent,"webOS") > 0 then
hpAgentDevice = "webOS"
elseIf InStr(hpStrUserAgent,"PalmOS") > 0 then
hpAgentDevice = "PalmOS"
elseIf InStr(hpStrUserAgent,"LINUX") > 0 or InStr(hpStrUserAgent,"Linux") > 0 then
hpAgentDevice = "Linux"
elseIf InStr(hpStrUserAgent,"Windows") > 0 then
hpAgentDevice = "Windows"
else
hpAgentDevice = "ETC"
end if
if hpAgentBrowser="IE6" or hpAgentBrowser="IE7" or hpAgentBrowser="IE8" or hpAgentBrowser="IE9" or hpAgentBrowser="IE10" or hpAgentBrowser="IE11" or hpAgentBrowser="Chrome" then
hpSwfCheck=0 ' flash 사용가능
else
hpSwfCheck=1
end if
dim hpRemoteIP
hpRemoteIP = request.ServerVariables("REMOTE_ADDR")
response.write "<br><br>"
response.write "UserAgent = "& hpStrUserAgent &"<br><br>"
response.write "Browser = "& hpAgentBrowser &"<br><br>"
'response.write "Flash = "& hpSwfCheck &"<br><br>"
response.write "OS = "& hpAgentDevice &"<br><br>"
%>
브라우저 Agent 정보
https://www.happyjung.com/bbs/board.php?bo_table=lecture&wr_id=2179 참고
플래시 IE 11 이후 일때 대응하기
안드로이드 기기, 애플 및 IE 11 에서는 object 를 이용한 플래시를 표시하지 않는 경우가 있음
이때는 embed를 이용하면 표현이 되므로, 아래와 같이 적용하면 해결가능합니다.
<%
if hpSwfCheck=1 then
%><object type="application/x-shockwave-flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="682" height="65" title="메뉴">
<param name="movie" value="menu.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" /></object><%
else
%><embed src="menu.swf" quality="high" wmode="transparent" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="682" height="65"></embed><%
end if
%>
참고자료
http://dojeun.egloos.com/318090
Dim hpStrUserAgent,hpAgentDevice,hpSwfCheck
'Request.ServerVariables("HTTP_USER_AGENT") ' 접속자의 에이젼트 정보를 얻는함수
hpStrUserAgent = Request.ServerVariables("HTTP_USER_AGENT")
'if request.ServerVariables("REMOTE_ADDR") = "내컴퓨터아이피" then ?' 내컴퓨터아이피찾기 ?http://ipconfig.co.kr
' response.write "hpStrUserAgent = "& hpStrUserAgent &"<br>"
'end if
If InStr(hpStrUserAgent,"Edge") > 0 then
hpAgentBrowser = "Edge"
elseIf InStr(hpStrUserAgent,"rv:11.0") > 0 then
hpAgentBrowser = "IE11"
elseIf InStr(hpStrUserAgent,"MSIE 10") > 0 then
hpAgentBrowser = "IE10"
elseIf InStr(hpStrUserAgent,"MSIE 9") > 0 then
hpAgentBrowser = "IE9"
elseIf InStr(hpStrUserAgent,"MSIE 8") > 0 then
hpAgentBrowser = "IE8"
elseIf InStr(hpStrUserAgent,"MSIE 7") > 0 then
hpAgentBrowser = "IE7"
elseIf InStr(hpStrUserAgent,"MSIE 6") > 0 then
hpAgentBrowser = "IE6"
elseIf InStr(hpStrUserAgent,"Opera") > 0 or InStr(hpStrUserAgent,"OPERA") > 0 or InStr(hpStrUserAgent,"OPR") > 0 then
hpAgentBrowser = "Opera"
elseIf InStr(hpStrUserAgent,"Firefox") > 0 or InStr(hpStrUserAgent,"FIREFOX") > 0 then
hpAgentBrowser = "Firefox"
elseIf InStr(hpStrUserAgent,"KAKAOTALK") > 0 then
hpAgentBrowser = "KakaoTalk"
elseIf InStr(hpStrUserAgent,"NAVER") > 0 then
hpAgentBrowser = "Naver"
elseIf InStr(hpStrUserAgent,"FBAN") > 0 or InStr(hpStrUserAgent,"FBAV") > 0 or InStr(hpStrUserAgent,"FBBV") > 0 or InStr(hpStrUserAgent,"FBRV") > 0 or InStr(hpStrUserAgent,"FBDV") > 0 or InStr(hpStrUserAgent,"FBMD") > 0 or InStr(hpStrUserAgent,"FBSN") > 0 or InStr(hpStrUserAgent,"FBSV") > 0 or InStr(hpStrUserAgent,"FBSS") > 0 or InStr(hpStrUserAgent,"FBCR") > 0 or InStr(hpStrUserAgent,"FBID") > 0 or InStr(hpStrUserAgent,"FBLC") > 0 or InStr(hpStrUserAgent,"FBOP") > 0 then
hpAgentBrowser = "Facebook"
elseIf InStr(hpStrUserAgent,"Chrome") > 0 or InStr(hpStrUserAgent,"CriOS") > 0 then
hpAgentBrowser = "Chrome"
elseIf InStr(hpStrUserAgent,"Android") > 0 or InStr(hpStrUserAgent,"ANDROID") > 0 then
hpAgentBrowser = "Android"
elseIf InStr(hpStrUserAgent,"Safari") > 0 or InStr(hpStrUserAgent,"SAFARI") > 0 then
hpAgentBrowser = "Safari"
else
hpAgentBrowser = "ETC"
end if
If InStr(hpStrUserAgent,"Android") > 0 then
hpAgentDevice = "Android"
elseIf InStr(hpStrUserAgent,"iPhone") > 0 then
hpAgentDevice = "iPhone"
elseIf InStr(hpStrUserAgent,"iPad") > 0 then
hpAgentDevice = "iPad"
elseIf InStr(hpStrUserAgent,"iPod") > 0 then
hpAgentDevice = "iPod"
elseIf InStr(hpStrUserAgent,"Macintosh") > 0 then
hpAgentDevice = "Macintosh"
elseIf InStr(hpStrUserAgent,"SymbianOS") > 0 then
hpAgentDevice = "SymbianOS"
elseIf InStr(hpStrUserAgent,"BlackBerry") > 0 then
hpAgentDevice = "BlackBerry"
elseIf InStr(hpStrUserAgent,"BB10") > 0 then
hpAgentDevice = "BB10"
elseIf InStr(hpStrUserAgent,"Nokia") > 0 then
hpAgentDevice = "Nokia"
elseIf InStr(hpStrUserAgent,"SonyEricsson") > 0 then
hpAgentDevice = "SonyEricsson"
elseIf InStr(hpStrUserAgent,"webOS") > 0 then
hpAgentDevice = "webOS"
elseIf InStr(hpStrUserAgent,"PalmOS") > 0 then
hpAgentDevice = "PalmOS"
elseIf InStr(hpStrUserAgent,"LINUX") > 0 or InStr(hpStrUserAgent,"Linux") > 0 then
hpAgentDevice = "Linux"
elseIf InStr(hpStrUserAgent,"Windows") > 0 then
hpAgentDevice = "Windows"
else
hpAgentDevice = "ETC"
end if
if hpAgentBrowser="IE6" or hpAgentBrowser="IE7" or hpAgentBrowser="IE8" or hpAgentBrowser="IE9" or hpAgentBrowser="IE10" or hpAgentBrowser="IE11" or hpAgentBrowser="Chrome" then
hpSwfCheck=0 ' flash 사용가능
else
hpSwfCheck=1
end if
dim hpRemoteIP
hpRemoteIP = request.ServerVariables("REMOTE_ADDR")
response.write "<br><br>"
response.write "UserAgent = "& hpStrUserAgent &"<br><br>"
response.write "Browser = "& hpAgentBrowser &"<br><br>"
'response.write "Flash = "& hpSwfCheck &"<br><br>"
response.write "OS = "& hpAgentDevice &"<br><br>"
%>
브라우저 Agent 정보
https://www.happyjung.com/bbs/board.php?bo_table=lecture&wr_id=2179 참고
플래시 IE 11 이후 일때 대응하기
안드로이드 기기, 애플 및 IE 11 에서는 object 를 이용한 플래시를 표시하지 않는 경우가 있음
이때는 embed를 이용하면 표현이 되므로, 아래와 같이 적용하면 해결가능합니다.
<%
if hpSwfCheck=1 then
%><object type="application/x-shockwave-flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="682" height="65" title="메뉴">
<param name="movie" value="menu.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" /></object><%
else
%><embed src="menu.swf" quality="high" wmode="transparent" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="682" height="65"></embed><%
end if
%>
참고자료
http://dojeun.egloos.com/318090
댓글목록
등록된 댓글이 없습니다.