Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #33890
| Path | csiph.com!aioe.org!news.mb-net.net!open-news-network.org!.POSTED.100.225.197.178.dynamic.wless.zhbmb00p-cgnat.res.cust.swisscom.ch!not-for-mail |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: detect a phone |
| Date | Sun, 27 Aug 2017 03:33:35 +0200 |
| Organization | PointedEars Software (PES) |
| Lines | 36 |
| Message-ID | <5327568.lOV4Wx5bFT@PointedEars.de> (permalink) |
| References | <WoqdnVwVzJe7ozzEnZ2dnUU7-YvNnZ2d@westnet.com.au> |
| Reply-To | Thomas 'PointedEars' Lahn <cljs@PointedEars.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| Content-Transfer-Encoding | 8Bit |
| Injection-Info | gwaiyur.mb-net.net; posting-host="100.225.197.178.dynamic.wless.zhbmb00p-cgnat.res.cust.swisscom.ch:178.197.225.100"; logging-data="9761"; mail-complaints-to="abuse@open-news-network.org" |
| User-Agent | KNode/4.14.2 |
| X-Face | %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v |
| Cancel-Lock | sha1:CjKu/hgqL97rpv7kGKqaZrua7dQ= |
| Face | iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg== |
| X-User-ID | U2FsdGVkX18LvCBnlXlsELQWOLGlHG/BzgTPanKIZO4j9DSN56CJsA== |
| Xref | csiph.com comp.lang.javascript:33890 |
Show key headers only | View raw
Andrew Poulos wrote:
> I've got a situation where it would be beneficial to know if the js is
> running on a phone and I thought "instead of parsing navigator.userAgent
> why not just check for the window screen size?"
First of all, because that is an oxymoron. What is “window screen size”
supposed to mean? In a windowing system, windows are displayed on the
screen, or more precisely on a desktop (area). There is a *window* size,
and a *screen* (precisely: desktop) size.
Second, none of them have anything to do with whether a Web application is
running on a mobile device (smartphone or tablet): On a desktop PC or
laptop/notebook, I can have a smaller window size for *any* reason – most
importantly, cascaded or tiled window arrangement. With virtual desktops,
I can also have a "screen" (_desktop_) smaller than the display resolution.
(This feature is now available on mobile devices, too, with standard
firmware.)
Display resolution != desktop size != browser window size != viewport size.
[psf 3.7]
> Currently no phone's viewport is larger than 600, in both width and
> height, so for the time being would something like
>
> var isPhone = (window.screen.width < 600 || window.screen.height < 600)
> && ("ontouchstart" in window);
>
> be a "safe" way test?
No.
--
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread
detect a phone Andrew Poulos <ap_prog@hotmail.com> - 2017-08-26 19:23 +1000
Re: detect a phone "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-08-26 11:44 +0200
Re: detect a phone Andrew Poulos <ap_prog@hotmail.com> - 2017-08-27 00:09 +1000
Re: detect a phone "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-08-26 20:02 +0200
Re: detect a phone Richard Maher <maher_rjSPAMLESS@hotmail.com> - 2017-08-26 20:42 +0800
Re: detect a phone "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-08-26 09:40 -0700
Re: detect a phone Andrew Poulos <ap_prog@hotmail.com> - 2017-08-27 08:48 +1000
Re: detect a phone "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-08-26 16:31 -0700
Re: detect a phone Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-08-27 03:35 +0200
Re: detect a phone JJ <jj4public@vfemail.net> - 2017-08-27 00:03 +0700
Re: detect a phone Andrew Poulos <ap_prog@hotmail.com> - 2017-08-27 08:21 +1000
Re: detect a phone Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-08-27 04:00 +0200
Re: detect a phone Andrew Poulos <ap_prog@hotmail.com> - 2017-08-27 18:13 +1000
Re: detect a phone Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-08-27 15:15 +0200
Re: detect a phone Mark Lloyd <not@mail.invalid> - 2017-08-27 11:30 -0500
Re: detect a phone Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-08-27 03:33 +0200
csiph-web