jonatec — 2013-06-07T13:42:55-04:00 — #1
Is this a reliable means of device detection, ie iPad, iPhone, Android, etc.. ?
Or is there a sensible alternative ?
Is there a definitive list of device names ?
chris_upjohn — 2013-06-08T06:01:57-04:00 — #2
jonatec — 2013-06-08T13:44:11-04:00 — #3
Not very enlightening, what happens to the value of .userAgent if the user changes the browser config ?
felgall — 2013-06-08T18:15:30-04:00 — #4
The useragent can be set to anything at all by the person who owns the browser. Firefox, chrome and Opera provide options to make this easier (to change it for IE you need to update the Registry). In Opera you can even set it up to present different useragent values to different web pages.
Since most people don't change it you can rely on its value for gathering statistics but you can't rely on it for anything else.
logic_ali — 2013-06-08T22:49:24-04:00 — #5
Google Maps is an example that relies on it entirely. When I loaded it using a blank UA, it slandered the capabilities of what was at the time the current FireFox.
jonatec — 2013-06-09T05:06:47-04:00 — #6
If you have a site with a large and cluttered content area, which is probably ok on a desktop/laptop, surely a responsive design will look rediculous on a smartphone with tiny viewport. In this scenario surely a simplified, optimised design would be better, ie user gets redirected to a separate site for mobile devices. In this case isn't device detection necessary to effect the redirect?
felgall — 2013-06-09T18:03:03-04:00 — #7
The best way to do device detection is by using media queries to check the viewport size. That way you can use a page layout that will fit the browser viewport regardless of what device it is. It is trivially easy to set up almost any browser on a computer so it has the same viewport size as a mobile device and reports the same useragent as that mobile device so that you have no way to teoll that it is actually being viewed on the computer and that the person doesn't even own the device it claims to be.
jonatec — 2013-06-10T03:31:38-04:00 — #8
Thanks for that.
I suppose .UserAgent used in a post-load js may be useful to determine mobile device or not, and then perhaps dynamically setting the <meta tag scale so that pinch/zoom is disabled ??