Reputation: 5039
I need a solution which will allow me to detect if the browser is mobile (i.e. iPhone, Android phone), desktop, or tablet (i.e. iPad, Nook). Based on the detection, it'll redirect to the appropriate site.
I could use WURFL but this is for a private company, and they are cheap and will not pay for the commercial license. I don't mind making the WURFL code itself public; but the class will be manipulated in a JSP page. If I only am required to make the class that uses the WURFL API code public, and not the surrounding JSP code, perhaps I can use it. That's the question: Behind a commercial entity, what is considered public information, with respect to the WURFL API? Do I have to make my JSP page open-source, too?
If I can't use WURFL, without paying for a commercial license, is there another bundled solution for Java or even JavaScript?
Thank you very much.
Upvotes: 2
Views: 8574
Reputation: 126
Be aware that regex-based solutions (such as JS-Redirection-Mobile-Site) will fail to correctly categorise some browsers. The biggest problem right now is Android tablets, many of which will be recognised as a mobile device by these solutions. If you really want to be sure about getting everything right you're going to have to use a server side solution, but it's possible that Android tablets don't yet constitute enough traffic to the site in question to be worth dealing with.
Disclaimer: I work for a provider of server side device detection solutions.
Upvotes: 1
Reputation: 1071
If you like WURFL and JavaScript is an option, I receommend you check out http://wurfl.io/
In a nutshell, if you import a tiny JS file:
<script type='text/javascript' src="//wurfl.io/wurfl.js"></script>
you will be left with a JSON object that looks like:
{
"complete_device_name":"Google Nexus 7",
"is_mobile":true,
"form_factor":"Tablet"
}
(that's assuming you are using a Nexus 7, of course) and you will be able to do things like:
if(WURFL.form_factor == "Tablet"){
//dostuff();
}
This is what you are looking for.
Disclaimer: I am the WURFL inventor and I work for the company that offers this free service. Thanks.
Upvotes: 2
Reputation: 516
Have a look at 51degrees.mobi who provide some of the data you need under the Mozilla Public Licence version 2.
There is also a self contained PHP version at SourceForge which is quick to implement.
Upvotes: 0
Reputation: 5038
You should look upon sebarmeli/JS-Redirection-Mobile-Site, it is based on javascript, both free and open source with ease of use and robustness.
Upvotes: 2