Identifying different mobile handsets and redirecting to different websites [duplicate]

Possible Duplicate:
Standard way to detect mobile browsers in a web application based on the http request

I have 3 mobile versions of a website and would like to present each to different handset models according to what they support. One version is monochromatic WML, another is color WML and another is XHTML for mobile.

What's the best way to identify the device in the request and know if it supports a version or another?

Asked by: Charlie526 | Posted: 23-01-2022

Answer 1

Check the User-Agent HTTP header on the inbound request and either use it to trigger a HTTP Redirect, or if you're using Apache use mod_rewrite and a RewriteCond to vary the result based on the User-Agent without requiring the extra HTTP roundtrip that a redirect uses.

Answered by: Catherine339 | Posted: 24-02-2022

Similar questions

Identifying the season from the Date using Java

I've had nothing but good luck from SO, so why not try again? I have an application that needs to show a different image based on the season of the year (spring, summer, winter, fall). I have very specific start and end dates for these seasons. What I would like from you geniuses is a method called GetSeason that takes a date as input and returns a String value of Spring, Summer, Winter or Fall. Here ar...

java - Identifying ajax request or browser request in grails controller

I am developing a grails application which uses lot of ajax.If the request is ajax call then it should give response(this part is working), however if I type in the URL in the browser it should take me to the home/index page instead of the requested page.Below is the sample gsp code for ajax call. <g:remoteFunction action="list" controller="todo" update="todo-ajax"> <div id ="todo-ajax"> //ajax...

Identifying 2 same images using Java

I have a problem in my web crawler where I am trying to retrieve images from a particular website. Problem is that often I see images that are exactly same but different in URL i.e. their address. Is there any Java library or utility that can identify if 2 images are exactly same in their content (i.e. at pixel level). My input will be URLs for the images where I can download them.

c# - Identifying last loop when using for each

I want to do something different with the last loop iteration when performing 'foreach' on an object. I'm using Ruby but the same goes for C#, Java etc. list = ['A','B','C'] list.each{|i| puts "Looping: "+i # if not last loop iteration puts "Last one: "+i # if last loop iteration } The output desired is equivalent to: Looping: 'A' Looping: 'B' Last one: ...

java - identifying sub-class at run time

I want to know how to identify subclasses at run time in java. In my program I am calling a method that returns a superclass object. The object can be an instance of any one of its sub-classes. I want to know the object is instance of which sub-class at run-time so that I can cast it to that subclass and access subclass methods. Can anyone help me in this? Thanks

java - Using SSL Socket for identifying clients

Can SSL sockets be used to identify clients? What i am thinking of is, can i configure an SSL socket to only accept connections from clients that have a certificate that i create beforehand?

java - Identifying a class which is extending an abstract class

Good Evening, I'm doing a major refactoring of to finally get better overview and maintainability. (I started the project when I decided to start programming, so – you get it, right? ;)) At the moment I wonder how to solve the problem I'll describe now: Every file will be put through s...

java - Hibernate: How do I write the HQL for getting records of an entity without records for its identifying relation

I have Hibernate Objects defined as Class SomeText{ private Long textId; private Set<Tag> Tags = new HashSet<Tag>(); @ManyToMany(cascade={CascadeType.PERSIST,CascadeType.MERGE }) @JoinTable(name = "text_tag_reln", joinColumns = { @JoinColumn(name = "textId") }, inverseJoinColumns = { @JoinColumn(name = "tagId") }) public Set<Tag> getTags() { return Tags; } }...

types - Java- Identifying ints and doubles

I want to write a conditional statement, depending on whether a variable is an int or double, i.e if (x is a double) do stuff else if(x is an int) do stuff else do stuff I know this might not be a good idea, but its my only choice for now. Is this possible?

arrays - Identifying syntax errors in Java

Given this code in Java: int i,j; String[] names; names[0] = new String("mary"); names[1] = "John"; i = names.length; j = names[0].length(); I need to find the error. As far as I can tell, lines 1, 2, 4, and 5 are correct because they involve simple instance variables, adding elements to arrays, and finding the length of an array. However lines 3 and 6 are weird. Can you add a str...

Still can't find your answer? Check out these amazing Java communities for help...

Java Reddit Community | Java Help Reddit Community | Java Community | Java Discord | Java Programmers (Facebook) | Java developers (Facebook)