Take the 2-minute tour ×

I'm using the JavaScript event onorientationchange and the parameter window.orientation to detect orientation changes and orientation values on my website. This works well with an iPhone and an Android. But a Windows Phone doesn't fire the onorientationchange event and window.orientation is undefined. How I detect orientation changes of Windows Phones?

Thanks, Konrad

share|improve this question
The tags iphone android and mobilen isnt correct please edit that tags –  Aracem Sep 2 '11 at 7:52

2 Answers 2

up vote 2 down vote accepted

IE9Mobile doesn't support these events.

If your page is being displayed inside a WebBrowser control within a (silverlight) app then you can detect the orientation change at app level and then invoke scripts on the page to pass this information.

If you're just running in the browser then there is no way to detect orientation changes.

share|improve this answer
Ok thank you. I also find out, that IE9Mobile doesn't support different basic JavaScript functions like document.getElementById –  Konrad Sep 5 '11 at 6:35

In CSS3 (works well with Mango, I don't know if in classic IE9 Mobile, but probably):

@media screen and (max-width: 480px)
/* CSS for Orientation Vertical */
@media screen and (min-width: 481px)
/* CSS for Orientation Horizontal */

Let me know if it worked!

share|improve this answer
Haven't Mango on my phone so far. But it's my hope that all stuff working with iPhones and Androids already will work with WinPhones then. Since I perform some other JS-tasks on rotation, I hope that there will be also new features in Mango's IE beside CSS3. –  Konrad Sep 15 '11 at 6:35

Your Answer


