2

I use LWP::UserAgent to access the web site. The site offers almost the same info in auto-selected layouts for pc (default?) and mobile. Some informations are easier to get in non default layout.

Which User-Agent most generic strings are recommended to identify web client as mobile or pc device?
LWP::UserAgent : $ua->agent('…');

P.S. So far for tests I use full string of randomly selected mobile device. It works but I would like to set proper "style-guide" - set and forget for LONG. I would like to avoid requirement for fixes every few years.

AnFi
  • 10,493
  • 3
  • 23
  • 47
  • 2
    I would pick a single device that is already a couple of years old and enjoyed a large market share. How do you like that idea? – daxim Sep 17 '19 at 08:50
  • I would like something better **but** it seems to be a pretty good fallback solution. – AnFi Sep 17 '19 at 09:52

1 Answers1

1

In my specific case Mozilla/5.0 (Mobile) delivers wanted results.
IMHO it is worth to try in other cases.

$ua->agent('Mozilla/5.0 (Mobile)');

I have tried it based on suggestion in
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent

Firefox UA string

[…] The UA string of Firefox itself is broken down into four components:

Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion

  • Mozilla/5.0 is the general token that says the browser is Mozilla compatible, and is common to almost every browser today.
  • platform describes the native platform the browser is running on (e.g. Windows, Mac, Linux or Android), and whether or not it's a mobile phone. Firefox OS phones simply say "Mobile"; the web is the platform.
    […]
Community
  • 1
  • 1
AnFi
  • 10,493
  • 3
  • 23
  • 47