[whatwg] Forcing orientation in content

David Bruant bruant.d at gmail.com
Wed Apr 17 15:52:47 PDT 2013


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.
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.



[5] https://developer.mozilla.org/en-US/docs/Apps/Manifest#orientation

More information about the whatwg mailing list