1

I'm doing a mobile site, and i need it to show screen as it always was in portrait orientation. Like Instagram app. works.

How could i do this with codes ?

if (window.orientation === 90 || window.orientation === -90) {
   window.orientation=0;
}
  • You can't lock the orientation. – Dávid Szabó Jul 13 '14 at 07:52
  • I didn't understand what u want. Do you want your website get turned to 90° ? Or you want it to show with low width and long height ? – Rahiil Jul 13 '14 at 09:08
  • [Someone has run into something slightly similar.](http://stackoverflow.com/questions/4806938/is-there-a-way-to-force-horizontal-landscape-layout-on-mobile-devices/4807047#4807047) But honestly, actually making a responsive design is a lot better than gettin' real hacky with it. – Morklympious Jul 13 '14 at 09:03

1 Answers1

2

Not a good idea in general but you can find discussion here :

Blocking device rotation on mobile web pages

How do I lock the orientation to portrait mode in a iPhone Web Application?

a solution could be to rotate the content using CSS3 on orientation change event.

Community
  • 1
  • 1
mohsen dorparasti
  • 8,107
  • 7
  • 41
  • 61