how to check if request is from mobile?

UI Components for JSF
Post Reply
javaone9
Posts: 317
Joined: 06 Nov 2012, 20:50

03 Sep 2014, 06:55

hi,

how to check if a request is from mobile? smart phone or tablet?

Is there a way to know device screen size?
so that I render different content depends on screen size?

Thanks,
Dave

rikup
Posts: 459
Joined: 29 Jan 2013, 14:27

03 Sep 2014, 07:47

http://uadetector.sourceforge.net/index.html

Offtopic, this was second link Google returned...
PrimeNG 2.0.0
Angular 2.4.5

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

03 Sep 2014, 17:57

and this is also in some PF js and server side code... But it just seems javaone9 is (as always) to lazy to search

javaone9
Posts: 317
Joined: 06 Nov 2012, 20:50

03 Sep 2014, 18:26

Thanks for the link. It seems to me a overkill for a simple check.

I am wondering if PFM has an API to call like xyz.isMobile(), xyz.getScreenSize().

rikup
Posts: 459
Joined: 29 Jan 2013, 14:27

03 Sep 2014, 20:16

Ah, sorry, my bad, I posted wrong link, this is easier alternative: https://code.google.com/p/mobileesp/sou ... tInfo.java.

And when there are simple solutions, no wonder PF doesn't have this kind of functionality included ;) No need to bloat own framework with something that is easy to add :)
PrimeNG 2.0.0
Angular 2.4.5

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

03 Sep 2014, 20:56

kukeltje wrote:and this is also in some PF js and server side code... But it just seems javaone9 is (as always) to lazy to search
true. i agree. this question has been asked multiple times in this forum.

search google for

site:forum.primefaces.org mobile desktop device

and the following is in the list of search results on google.com.

Mobile Device

sharing this for someone else that searches and finds this topic later.
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 41 guests