CafeHey
CafeHey

Reputation: 5800

Jquery, how to test for a mobile browser?

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

Cheers.

Upvotes: 4

Views: 1299

Answers (1)

Dead account
Dead account

Reputation: 19960

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.

Upvotes: 1

Related Questions