Detect tablet and smartphone browsers with Javascript

For those who like to stay on the client
wurfllover
Posts: 6
Joined: Fri Oct 19, 2012 4:22 pm

Detect tablet and smartphone browsers with Javascript

Postby wurfllover » Sat Apr 05, 2014 7:47 pm

Hi, I have seen the announcement of WURFL.js. Is WURFL.js a reliable way to detect wheteher a browser is running on a smartphone or a tablet?

There are several optimizations that I would like to do based on this bit of information.

Best Regards

sm_support2
Posts: 294
Joined: Mon Jun 20, 2011 5:04 pm

Re: Detect tablet and smartphone browsers with Javascript

Postby sm_support2 » Sat Apr 05, 2014 7:57 pm

Hi Wurfl Lover,
Is WURFL.js a reliable way to detect wheteher a browser is running on a smartphone or a tablet?
The answer to your question is "yes. Of Course!". You just need to include the following script to the pages where you want tablets detected:

Code: Select all

<script type='text/javascript' src="//wurfl.io/wurfl.js"></script>
In order to detect a smartphone, you can simply do:

Code: Select all

if (WURFL.form_factor == 'Smartphone'){
	//do things that are specific to Smartphone
}
For tablets, it's very similar:

Code: Select all

if (WURFL.form_factor == 'Tablet'){
	//do things that are specific to Tablet
}
Please let us know how it works for you. Thanks

msantoli
Posts: 1
Joined: Thu Apr 10, 2014 6:21 am

Re: Detect tablet and smartphone browsers with Javascript

Postby msantoli » Thu Apr 10, 2014 6:23 am

Hi,

We started to test wurfl.js and we are experiencing issues when detecting iphone 4/4s/5/5s device.

They all respond with:
is_mobile: default
form_factor: Robot

Any hints on how to solve this?
Thanks
Massimo

sm_support2
Posts: 294
Joined: Mon Jun 20, 2011 5:04 pm

Re: Detect tablet and smartphone browsers with Javascript

Postby sm_support2 » Thu Apr 10, 2014 6:59 am

Massimo, something isn't right here. Are you using the built in browser? are you going through some proxy of some kind to reach the Internet?

can you please snoop the HTTP headers at this URL: http://db.scientiamobile.com/h

Please send us a note once the headers are captured.

Thanks

Heihachi07
Posts: 1
Joined: Wed Jan 28, 2015 12:46 am

Re: Detect tablet and smartphone browsers with Javascript

Postby Heihachi07 » Wed Jan 28, 2015 12:48 am

The wording of the license is a little vague. The e-commerce site is available to the public free of charge and does not require a fee-based subscription or other fee-based restricted access, so can we use wurfl.js?

Thanks

luca.passani
Posts: 65
Joined: Thu May 19, 2011 2:49 pm

Re: Detect tablet and smartphone browsers with Javascript

Postby luca.passani » Wed Jan 28, 2015 11:12 am

so can we use wurfl.js?
yes, you are welcome to use it compatibly with the rules explained in the license.

If there are specific parts of the license you find too restrictive, we have a WURFL.JS Business Edition ready (not yet announced). That product is not free, but it provides extra features and removes some of the restrictions of the Community Edition License.

Thank you


Who is online

Users browsing this forum: No registered users and 1 guest