Prevent screen rotation - Forum

Forum Navigation
You need to log in to create posts and topics.

Prevent screen rotation

Hi Luis,

Is it possible to prevent screen rotation (portrait/landscape) of created app, on mobile phone or tablet ?

...I mean on IOS devices. I have done a sample of neoWebCam. OK on ANDROID, but rotate (portrait/landscape) on IOS.

Oups...no, finally I also tried on an other ANDROID phone, and it also rotate ....

@cdy44-2 have you tried this?

Uploaded files:
  • You need to login to have access to uploads.

Hi Luis,

Yes of course. In fact I have published my sample as PWA. I put it on main screen of 3 smartphones. 2 with ANDROID, and 1 with  IOS.

Finally, contrary to what I said last night (I was quite tired, but too happy to try the last update !),
it is OK on ANDROID phones (no rotation), but not on IOS (rotation). Perhaps a specificity of IOS.

Best regards

@cdy44-2 I think this should work:

BeginJS
ScreenOrientation.lock("landscape");
EndJS

Othe possible values:

  • "any"
  • "natural"
  • "landscape"
  • "portrait"
  • "portrait-primary"
  • "portrait-secondary"
  • "landscape-primary"
  • "landscape-secondary"

More info here:
https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/lock

Regards

CDY@44 has reacted to this post.
CDY@44

Thank you Luis, Il will try it.