Page 1 of 1

Detect tablet and smartphone browsers with Javascript

Posted: Sat Apr 05, 2014 7:47 pm
by wurfllover
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

Re: Detect tablet and smartphone browsers with Javascript

Posted: Sat Apr 05, 2014 7:57 pm
by sm_support2
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

Re: Detect tablet and smartphone browsers with Javascript

Posted: Thu Apr 10, 2014 6:23 am
by msantoli
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

Re: Detect tablet and smartphone browsers with Javascript

Posted: Thu Apr 10, 2014 6:59 am
by sm_support2
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

Re: Detect tablet and smartphone browsers with Javascript

Posted: Wed Jan 28, 2015 12:48 am
by Heihachi07
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

Re: Detect tablet and smartphone browsers with Javascript

Posted: Wed Jan 28, 2015 11:12 am
by luca.passani
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