I'm using a CGI script to generate a dynamic webpage. I want the page to load elements differently depending on whether or not the user is using a phone (such as a blackberry) to access the website or a normal browser. Is there an environment detail I can grab to make this decision? What would be the best method of doing this (even if its using javascript and not CGI.)
In summary, we recommend looking for the string “Mobi” anywhere in the User Agent to detect a mobile device. Like this: if (/Mobi/. test(navigator.
Use the Perl variable $ENV{'HTTP_USER_AGENT'}
and the HTTP::BrowserDetect module.
Once you have the determined what browser the client is using (e.g. is it a mobile browser) - then you can make the decision on what to send back to the client (mobile version or desktop version etc)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With