jquery/jquery-mobile — Issue #2933: get_orientation() and hence getScreenHeight() doesn't work on some devices
Author: dmfallak
Created: 2011-11-04 14:20:44+00:00
State: open

This problem is reproducible only in the JQueryMobile 1.0RC2 release, and wasn't reproducible in beta 2.

On iPad 2 with iOS 5, I observe that window.orientation is -90 when in landscape mode. However on Thinkpad running Android 3.1, window.orientation is 0 when in landscape mode. When running Playbook OS 2, window.orientation is also 0 when in landscape mode. Because of this, jQuery.event.special.orientationchange.orientation() returns the wrong value on Android and Playbook but the right value on iPad.

It seems like using window.orientation to determine whether the device is in landscape or portrait is not a reliable way of doing it. Maybe it would be best to determine this by checking whether the windows dimensions are wider or taller?

Here is a test page that demonstrates this issue:

Test Orientation