asp peeps


asp peeps

Postby brian33433@aol.com on Mon 05 Apr 2010, 16:56

how would i transfer this for asp, i'm so mot a asp person

<? if(strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'],'iPod'))
{
header('Location: http://istuffonline.com/iphone.htm');
exit();
} ?>

Thanks
B.
brian33433@aol.com
iWebKit lover
iWebKit lover
 
Posts: 46
Joined: Thu 03 Dec 2009, 17:51

Re: asp peeps

Postby gdscei on Mon 05 Apr 2010, 17:53

Why don't you just use this

Code: Select all
<script type="text/javascript">
<!--
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))){http://istuffonline.com/iphone.htm} else {};
-->
</script>
Proud to be a Die-Hart fan :D
Current project I am busy with: The BETTER TabBar
My latest creation: iDC
Don't forget to check out my Twitter, website and the iWebkitWiki.
User avatar
gdscei
Die-Hart fan
Die-Hart fan
 
Posts: 612
Joined: Sun 08 Nov 2009, 17:10
Location: The Netherlands

Re: asp peeps

Postby Christopher on Mon 05 Apr 2010, 19:00

Image
User avatar
Christopher
Site Admin
Site Admin
 
Posts: 1023
Joined: Wed 10 Dec 2008, 23:01
Location: France

Re: asp peeps

Postby brian33433@aol.com on Mon 05 Apr 2010, 19:52

gd unfortunately that didn't work. Chris i hate homework, lol
brian33433@aol.com
iWebKit lover
iWebKit lover
 
Posts: 46
Joined: Thu 03 Dec 2009, 17:51

Re: asp peeps

Postby Christopher on Mon 05 Apr 2010, 20:18

lol ;) sorry but i can't help more. And i hate doing homework for someone else :p
Image
User avatar
Christopher
Site Admin
Site Admin
 
Posts: 1023
Joined: Wed 10 Dec 2008, 23:01
Location: France

Re: asp peeps

Postby TeamUgly on Thu 22 Apr 2010, 19:21

Brian,
It might be more verbose than what you're looking for but here's an example in ASP that should do the trick (this code is meant to redirect most mobile devices)...

Code: Select all
      'Check for mobile browser
      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

      mobile_agents = Array("ipho", "ipod", "ipad","w3c ", "acs-", "alav", "alca", "amoi", "audi", "avan", "benq", "bird", "blac", "blaz", "brew", "cell", "cldc", "cmd-", "dang", "doco", "eric", "hipt", "inno", "ipaq", "java", "jigs", "kddi", "keji", "leno", "lg-c", "lg-d", "lg-g", "lge-", "maui", "maxo", "midp", "mits", "mmef", "mobi", "mot-", "moto", "mwbp", "nec-", "newt", "noki", "oper", "palm", "pana", "pant", "phil", "play", "port", "prox", "qwap", "sage", "sams", "sany", "sch-", "sec-", "send", "seri", "sgh-", "shar", "sie-", "siem", "smal", "smar", "sony", "sph-", "symb", "t-mo", "teli", "tim-", "tosh", "tsm-", "upg1", "upsi", "vk-v", "voda", "wap-", "wapa", "wapi", "wapp", "wapr", "webc", "winw", "winw", "xda", "xda-")


      size = Ubound(mobile_agents)
      mobile_ua = LCase(Left(user_agent, 4))

      For i=0 To size
         If mobile_agents(i) = mobile_ua Then
            mobile_browser = mobile_browser+1
            Exit For
         End If
      Next

      If mobile_browser>0 Then
         Response.Redirect("http://stuffonline.com/iphone.htm")
      Else
         Response.Redirect("http://istuffonline.com")
      End If
TeamUgly
iWebKit lover
iWebKit lover
 
Posts: 31
Joined: Sat 27 Mar 2010, 04:44

Re: asp peeps

Postby brian33433@aol.com on Thu 22 Apr 2010, 19:40

do i place it in the head, as-is?
brian33433@aol.com
iWebKit lover
iWebKit lover
 
Posts: 46
Joined: Thu 03 Dec 2009, 17:51


Return to Javascript bugs

Who is online

Users browsing this forum: No registered users and 1 guest