I have a webapp saved to the iPhone homescreen, and I need to run some JavaScript when the device changes orientation.
I tried this, but it only seemed to work in a desktop browser and not on the iPhone.
window.onresize = function() {
alert('rotation change!');
};
Is there some special event I’m supposed to hook into?
You’re looking for
onorientationchange.