I\'m adapting a small HTML/CSS/Javascript driven web magazine as an iApp for the iPad with the great mobile framework PhoneGap. Everything works great, except the orientation ch
I just found an other solution to the problem. I use the body onload function with the onDeviceReady function from phonegap.js to check the orientations:
The following javascript code works properly now:
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady() {
document.addEventListener("orientationChanged", updateOrientation);
}
function updateOrientation(e) {
switch (e.orientation) {
case 90:
window.location = "index_landscape.html";
break;
case -90:
window.location = "index_landscape.html";
break;
}
}
UPDATE: This worked more than two years ago with old versions of Phonegap and iOS SDK, but according some users, it doesn't work anymore.