Current time: 12-08-2019, 10:32 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fastest method to identify user agent
04-10-2013, 03:54 AM
Post: #1
Fastest method to identify user agent
What is the fastest method to find out which browser a vistor is using? I need to do a redirect from my website to another website and this redirect should be different depending on the visitors user agent.

Thank you!
Find all posts by this user
Quote this message in a reply
04-16-2013, 03:25 AM
Post: #2
RE: Fastest method to identify user agent
A user agent match in your web server config is going to be the fastest way to do it. That way the server can do the redirect without having to start up a cgi process of any kind (how you do it differes depending on the server - apache, nginx, etc).

It also somewhat depends on how complicated you need to be in detecting the browser. Something like "Mobile" vs "Desktop" can be a crazy exercise to do and there are entire databases that are devoted to maintaining the UA strings for the devices.
Visit this user's website Find all posts by this user
Quote this message in a reply
04-16-2013, 11:51 PM
Post: #3
RE: Fastest method to identify user agent
@pmeenan

Thank you for your answer! Does that mean we should use mod_rewrite to do the redirect based on the user agent on Apache?
Find all posts by this user
Quote this message in a reply
04-17-2013, 12:30 AM
Post: #4
RE: Fastest method to identify user agent
Yes, if you are on apache and you can define your user agents succintly enough, mod_rewrite would be your fastest way to do the redirects.
Visit this user's website Find all posts by this user
Quote this message in a reply
04-17-2013, 09:24 PM
Post: #5
RE: Fastest method to identify user agent
Thank you for your help, @pmeenan!
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)