Skip to content

Instantly share code, notes, and snippets.

@puleos
Created September 18, 2012 15:21
Show Gist options
  • Save puleos/3743726 to your computer and use it in GitHub Desktop.
Save puleos/3743726 to your computer and use it in GitHub Desktop.
Mooveweb redirect
'************ Moovweb Mobile Redirect -BEGIN***********
Dim endOfProtocol, endofDomain, currentPath
endOfProtocol = InStr(Request.ServerVariables("CACHE_URL"),"//")
endOfHost = InStr(endOfProtocol + 2, Request.ServerVariables("CACHE_URL"),"/")
currentPath = Mid(Request.ServerVariables("CACHE_URL"), endOfHost)
if ignoreMobileRedirect <> true then
if InStr(Request.ServerVariables("HTTP_VIA"), "moovweb") = 0 then
if(Request.Cookies("mw_mobile_site") <> "") then
if (Request.Cookies("mw_mobile_site") = true) then
checkMobileBrowser()
end if
else
checkMobileBrowser()
end if
end if
end if
Function checkMobileBrowser()
if(InStr(Request.ServerVariables("HTTP_USER_AGENT"),"Android") or _
InStr(Request.ServerVariables("HTTP_USER_AGENT"),"iPod") or _
InStr(Request.ServerVariables("HTTP_USER_AGENT"),"iPhone") or _
InStr(Request.ServerVariables("HTTP_USER_AGENT"),"Blackberry") or _
InStr(Request.ServerVariables("HTTP_USER_AGENT"),"Windows Phone") or _
InStr(Request.ServerVariables("HTTP_USER_AGENT"),"WebOS") or _
InStr(Request.ServerVariables("HTTP_USER_AGENT"),"Googlebot-Mobile") or _
InStr(Request.ServerVariables("HTTP_USER_AGENT"),"MSN Mobile Proxy") _
) then
Response.Redirect("http://m.puritan.com" & currentPath)
end if
End Function
'************ Moovweb Mobile Redirect -END***********
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment