[whatwg] Forcing orientation in content

Charles McCathie Nevile chaals at yandex-team.ru
Wed Apr 17 16:03:08 PDT 2013


On Thu, 18 Apr 2013 01:52:47 +0300, David Bruant <bruant.d at gmail.com>  

> Hi,
> Currently working on a web project where tablet support (iPad  
> especially) is important, I'm facing a need which apparently the  
> platform doesn't support.
> I would need to lock the screen in landscape mode.

Not sure if WHATWG is doing anything, but in the W3C there is  
https://dvcs.w3.org/hg/screen-orientation/raw-file/tip/Overview.html in  
the Web Apps group (by Mounir, who works on Firefox OS as a day job)

I expect to know a bit more about the implementation status of this in  
about a week, when the group has a face to face meeting.



> I've been searching and StackOverflow suggested this is not possible  
> [1][2][3][4]. The best solution that I have read online was to listen to  
> orientation changes, update an "orient" attribute (on <body> or <html>)  
> and change the CSS based on that. Or Media Queries. But I don't really  
> want to play with either JavaScript or CSS, I don't really know why I  
> should. Especially given that in some comments [1], it is suggested that  
> it is possible to lock the orientation in native apps.
> Beyond my current project, I have participated to a "FirefoxOS app days"  
> in Bucharest (helped people developing their apps mostly answering their  
> questions). A participant wanted to port his website (games for ~5yo  
> kids) as an FirefoxOS app and told me clearly that if he had no way to  
> lock the screen in landscape, he wouldn't be interested in FirefoxOS  
> (pretty sharp opinion, but that's what he said). Fortunately, that's  
> possible, but one has to use metadata to do so [5].
> So I feel the need is there.
> I was wondering if it would be possible to add a <meta> (or whatever  
> else is felt more relevant) to lock the orientation declaratively. It  
> sounds like an information that belongs to the <head>. I feel the  
> FirefoxOS experience [5] sets a good example.
> Thanks,
> David
> [1]  
> http://stackoverflow.com/questions/2772691/is-it-possible-to-prevent-iphone-ipad-orientation-changing-in-the-browser/2772748#2772748
> [2]  
> http://stackoverflow.com/questions/8738072/forcing-web-site-to-show-in-landscape-mode-only
> [3]  
> http://stackoverflow.com/questions/3217805/force-orientation-on-ipad-javascript
> [4]  
> http://stackoverflow.com/questions/1207008/how-do-i-lock-the-orientation-to-portrait-mode-in-a-iphone-web-application
> [5] https://developer.mozilla.org/en-US/docs/Apps/Manifest#orientation

Charles McCathie Nevile - Consultant (web standards) CTO Office, Yandex
       chaals at yandex-team.ru         Find more at http://yandex.com

More information about the whatwg mailing list