허당 레몬도리

<%
Dim user_agent, mobile_browser, Regex, match, mobile_agents, mobile_ua, i, size
user_agent = Request.ServerVariables("HTTP_USER_AGENT")
mobile_browser = 0
Set Regex = New RegExp
With Regex
.Pattern = "(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|windows ce|pda|mobile|mini|palm)"
.IgnoreCase = True
.Global = True
End With
match = Regex.Test(user_agent)
If match Then mobile_browser = mobile_browser+1
If InStr(Request.ServerVariables("HTTP_ACCEPT"), "application/vnd.wap.xhtml+xml") Or Not IsEmpty(Request.ServerVariables("HTTP_X_PROFILE")) Or Not IsEmpty(Request.ServerVariables("HTTP_PROFILE")) Then
mobile_browser = mobile_browser+1
end If
' // Now you're going through the list of devices,
' // this is an array so as time moves on, just add
' // more that come to the marketplace into here
mobile_agents = Array("alcatel", "amoi", "android", "avantgo", "blackberry", "benq", "cell", "cricket", "docomo", "elaine", "htc", "iemobile", "iphone", "ipad", "ipaq", "ipod", "j2me", "java", "midp", "mini", "mmp", "mobi", "motorola", "nec-", "nokia", "palm", "panasonic", "philips", "phone", "sagem", "sharp", "sie-", "smartphone", "sony", "symbian", "t-mobile", "telus", "up\.browser", "up\.link", "vodafone", "wap", "webos", "wireless", "xda", "xoom", "zte")
size = Ubound(mobile_agents)
mobile_ua = LCase(Left(user_agent, 4))
' // You've previously set mobile_browser as 0,
' // now loop through the array set above and
' // if one or more is matched, add 1 to this variable
For i = 0 To size
If mobile_agents(i) = mobile_ua Then
mobile_browser = mobile_browser+1
Exit For
End If
Next
' // Check that full website has not been requested
' // (you can have a link in the page for this like:
' // View Full Site
If request.querystring("v")="full" then session("fullsite")=true
' // Check to see if the var mobile_browser is greater
' // than 0, if so it's a mobile device, act accordingly.
If mobile_browser>0 and session("fullsite")=false then
' // redirect the user to a mobile appropriate page you've written
response.redirect("mobile/mobile-version.asp")
Else
response.redirect("explorer-version.asp")
End If
' END MOBILE PHONE SCRIPT
' =======================
%>

profile

허당 레몬도리

@LemonDory

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!