Orientation events do not work for the iPhone and iPad simulator

Davin McCoud's Avatar

Davin McCoud

02 Oct, 2012 04:19 PM

The orientation events do not work for the iPhone and iPad simulators. Using this code shows that they do not exist.

if (window.DeviceOrientationEvent) {
console.log("DeviceOrientation is supported"); } else if (window.OrientationEvent) { console.log("MozOrientation is supported"); }

window.DeviceOrientationEvent is supported in Chrome. Is there a configuration option that must be changed or is this event not supported at this time? If it is not supported, when will it be supported and how can I get an update?

Thank you.

  1. Support Staff 1 Posted by Shaun Sullivan on 02 Oct, 2012 05:32 PM

    Shaun Sullivan's Avatar

    We are actually firing the event, but it appears there is an issue with the window.DeviceOrientationEvent test.

    This code will work (e.g. the event will be fired):

    window.onorientationchange = function() {

    alert (window.orientation);
    

    };

  2. 2 Posted by Davin McCoud on 02 Oct, 2012 06:37 PM

    Davin McCoud's Avatar

    Thank you. That worked great.

    We tried this

             window.addEventListener("orientationchange", onOrientationChanged, false);
    

    but it did not work. What you suggested does work.

    Thank you.

  3. 3 Posted by Davin McCloud on 02 Oct, 2012 06:40 PM

    Davin McCloud's Avatar

    Thank you. That worked great.
    We tried this
                 window.addEventListener("orientationchange", SCADALynxMobile.onOrientationChanged, false);
     but it did not work. What you suggested does work.
    Thank you.
    > From: [email blocked]
    > To: [email blocked]
    > Date: Tue, 2 Oct 2012 13:32:22 -0400
    > Subject: Re: Orientation events do not work for the iPhone and iPad simulator [Electric Mobile Studio - Problems #78]
    >

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

06 Oct, 2021 05:12 AM
20 Sep, 2021 04:14 PM
02 Aug, 2021 04:22 AM
29 Jul, 2021 07:22 AM
28 Jul, 2021 05:37 AM