views:

51

answers:

2

Hi,

How do you test for, for example, and android browser in Jquery?

Cheers.

A: 

Do you want to test for a mobile browser or one with a small screen?

In javascript I would write

var isSmallScreen = ((screen.width * screen.width) + (screen.height * screen.height))
                     <= ((640*640)+(480*480));

to see if the screen is smaller than something like 640 x 480.

Dead account
+3  A: 

See this article from ppk about combining Javascript and CSS media queries for mobile specific rendering.

roryf
+1 ah brilliant, and there's me writing my own Javascript to do just that!
Dead account