0

I created a smartphone interface on my site in CF and javascript. It seems to work great on the smartphones I have tested. The problem is that it is a vertical alignment with horizontal images rotated 90 deg ccw and so the site has some photos that the phone must be turned cw to maintain image size and proportions.

I used this code to get the browser size and create the site to fit:

window.location.href = "1.cfm?Wth=" + size.width + + size.height + "";

Is there any way I can instruct either the phone or browser not to auto rotate? Preferrably with javascript.

Leigh
  • 28,765
  • 10
  • 55
  • 103
Andy
  • 169
  • 1
  • 1
  • 12

1 Answers1

2

You can't disable auto rotation on smartphone browser.
And even if you could, you should not. It's not user-friendly.

But if you really want, there is a dirty hack that involves returning the entire page to the rotation event : Blocking device rotation on mobile web pages.

If it's only an image size problem, resize your images when a rotation screen event is triggered.

Community
  • 1
  • 1
Damien
  • 3,915
  • 1
  • 17
  • 18
  • guess ur right Damian. Just ask visitors to turn off auto rotate but so few seem to even know how to do this. give them a picture of the little icon i guess... as far as re-sizing images. it really would make the horizontal ones small and they would look lost in the window. – Andy Sep 11 '14 at 08:31
  • Yes ask visitors to turn off the auto rotate is impossible, they don't know how to do this and it's a really bad practice. I think you have to redesign your interface.Usually a responsive design with CSS values in percent ​​and some media queries do the job. – Damien Sep 11 '14 at 08:55