Fórum

How to identify a mobile browser??

Abner Rolim, modificado 16 Anos atrás.

How to identify a mobile browser??

New Member Mensagem: 1 Data de Entrada: 20/11/07 Postagens 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 [en]

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
thumbnail
Jorge Ferrer, modificado 16 Anos atrás.

RE: How to identify a mobile browser??

Liferay Legend Postagens: 2871 Data de Entrada: 31/08/06 Postagens Recentes
Hi Abner,

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


	public static boolean is_wap_xhtml(HttpServletRequest req) {
		if (req == null) {
			return false;
		}

		String accept = req.getHeader(HttpHeaders.ACCEPT);

		if (accept == null) {
			return false;
		}

		accept = accept.toLowerCase();

		if (accept.indexOf("wap.xhtml") != -1) {
			return true;
		}
		else {
			return false;
		}
	}


As you can see, the only HTTP header considered is the accept header.
simon tuffle, modificado 12 Anos atrás.

RE: How to identify a mobile browser??

Regular Member Postagens: 150 Data de Entrada: 18/05/09 Postagens 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,