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

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:

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

IE
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?

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

Jorge Ferrer

LIFERAY STAFF

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:

 1
 2    public static boolean is_wap_xhtml(HttpServletRequest req) {
 3        if (req == null) {
 4            return false;
 5        }
 6
 7        String accept = req.getHeader(HttpHeaders.ACCEPT);
 8
 9        if (accept == null) {
10            return false;
11        }
12
13        accept = accept.toLowerCase();
14
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
Resposta

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.


Regards,