2

What is the simpliest way to determine device window orientation? I know how it works onresize method and window.innerWidth > window.innerHeight but It should be something that fit for phone devices too. I mean the keyboard, it's a little problem for me, because if I use classic methods they runs too when keyboard opens, and I don't want it. I need only a thing that works when the phone device changes its orientation. It also should to fit iOS and Android, because I noticed that on iOS when the keyboard opens the height it's not the same as on Android devices. Maybe someone knows the universal method to do this? I'll appreciate any advices where to look to find the best way!

NOTE: this is not a duplicate, I DON'T need just window.innerWidth > window.innerHeight

Robbie KN
  • 317
  • 1
  • 8

1 Answers1

1

Hey try to use deviceorientation to handle the device orientation

window.addEventListener("deviceorientation", handleOrientation, true);

here is an emxemple :Processing orientation events