Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: redirect based on user agent


Message #1 by jake williamson 28 <jake.williamson@2...> on Mon, 25 Mar 2002 14:26:59 +0000
hello!

looking for a reliable way of redirecting users with the netscape/mozilla
4.7 or bellow browser.

the site we've designed works perfectly in ie4 and above and netscape 6 and
above - it just fails miserably in 4.7 on mac, pc or linux/unix. we are
getting hits from these browsers though.

javascript isn't reliable enough (tried it and it's too hit and miss) is
there a way to do it using asp variables?

i've dont it with php where you pregmatch the variables, so....

can you set something up that does:

set a variable called = browser

browser = Request.ServerVariables("HTTP_USER_AGENT")

check to see if it's ns4.7

if it is send it to a redirected page saying please upgrade

i've had a look around and there seems to be a lot of 'microsoft' only
solutions...

any ideas oh gurus???

cheers,

jake

Message #2 by "Mack Samuel" <mack.samuel@h...> on Wed, 27 Mar 2002 14:52:57
Use the META redirect . . . works on any browser (including NS 4.7x).

<!-- must be used inside the HEAD section -->
<meta http-equiv="refresh" 
content="25;url=http://www.mynewurl.com/redirectpage.html">


NOTE: 25 = time in seconds to take redirect action


For more information:
http://vancouver-webpages.com/META/metatags.detail.html#refresh

Hope that helps.

> hello!

looking for a reliable way of redirecting users with the netscape/mozilla
4.7 or bellow browser.

Message #3 by "Mack Samuel" <mack.samuel@h...> on Wed, 27 Mar 2002 15:01:41
Oops! I totally misread. I apologize.

To detect the browser type/version and redirect accordingly, try this 
pretty cool online tool (supports 9 different redirects):
http://www.echoecho.com/toolbrowserredirect.htm



If that doesn't meet your needs, try this:
http://www.javascriptcity.com/scripts/local/sdetect5.htm


Or go crazy at:
http://www.hotscripts.com/JavaScript/Scripts_and_Programs/Redirection/Brows
er_Based/


Hope this helps.
Message #4 by "Mack Samuel" <mack.samuel@h...> on Wed, 27 Mar 2002 15:11:17
And if you don't like JavaScript, try something along these lines:


Sub Session_OnStart
    strBrowser=ucase(request.servervariables("HTTP_USER_AGENT"))
    if instr(strBrowser, "MSIE 4")=0 and instr(strBrowser, "MSIE 5")=0 and
instr(strBrowser, "MSIE 6")=0 then
        response.redirect("Incompatible.asp")
    end if
End Sub


For more info:
http://www.4guysfromrolla.com/webtech/092298-3.shtml

  Return to Index