How to detect in perl if the client uses a mobile browser?

I am using a CGI script to create a dynamic web page. I want the page to load elements differently depending on whether the user uses the phone (for example, blackberries) to access the website or in a normal browser. Are there any details of the environment that I can take to make this decision? What would be the best way to do this (even if it uses javascript, not CGI.)

+5
source share
1 answer

Use the Perl variable $ENV{'HTTP_USER_AGENT'}and HTTP :: BrowserDetect .

Once you have determined which browser the client uses (for example, this is a mobile browser), you can decide what to send back to the client (mobile version or desktop version, etc.).

+12
source

All Articles