How can I lock the aspect to portrait only?

How can I lock the aspect to portrait only? I don’t want my app to rotate around when the device is rotated. I only want to support portrait ratios.
Thanks

Hmm, that’s actually not possible in most browsers. What I usually do is detect when the orientation changed to landscape and show a dialog that instructs the user to rotate his device to portrait.

As soon as he does it, I hide the dialog.

Oh no, that sounds like a bit more work. It doesn’t sound very clean either :frowning:

How do you going about testing if we are in portrait or landscape?
Presumably you just test if the width is greater than the height or vice versa but do you know the syntax for this?

Exactly!

Another thought is to detect the orientation event on mobile and rotate the camera on the Z axis

1 Like