Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
Abner Rolim
How to identify a mobile browser??
20 de Novembro de 2007 11:21

Abner Rolim

Ranking: New Member

Mensagens: 1

Data de entrada: 20 de Novembro de 2007

Mensagens recentes

I am using the Microsoft Device Emulator (Pocket PC). In the Opera browser the Liferay portal shows up using the mobile theme, but with a IE for mobile the default theme is shown.

Using TCPMon to trace the requests I got the following results:

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; PPC; 240x320) Opera 8.60

User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)

How can I identify the the IE as a mobile browser? (so it can use the mobile theme)
Is there a XML file where this information can be found and added?

Jorge Ferrer
RE: How to identify a mobile browser??
25 de Novembro de 2007 12:22

Jorge Ferrer


Ranking: Liferay Legend

Mensagens: 2764

Data de entrada: 31 de Agosto de 2006

Mensagens recentes

Hi Abner,

The match is done through the following method of the BrowserSniffer class:

 2    public static boolean is_wap_xhtml(HttpServletRequest req) {
 3        if (req == null) {
 4            return false;
 5        }
 7        String accept = req.getHeader(HttpHeaders.ACCEPT);
 9        if (accept == null) {
10            return false;
11        }
13        accept = accept.toLowerCase();
15        if (accept.indexOf("wap.xhtml") != -1) {
16            return true;
17        }
18        else {
19            return false;
20        }
21    }

As you can see, the only HTTP header considered is the accept header.
Sharath Babu A
RE: How to identify a mobile browser??
6 de Setembro de 2011 05:48

Sharath Babu A

Ranking: Regular Member

Mensagens: 141

Data de entrada: 18 de Maio de 2009

Mensagens recentes

Hi Jorge Ferrer,

Currently i am running my portal with liferay6.0.4. Now i want to access the same portal in iphone,blackberry.
I have applied the iPhone-theme.war to the portal in LoodandFeel->Mobile Browser. But still i am able to see the default theme in the mobile.