If you haven't read yet this great post from @firt entitled Safari on iOS 7 and HTML5: problems, changes and new APIs you probably should before you can understand what is this about ... done? Great!
Some Clarification
Maximiliano took mobile twitter to show what happens when you visit a webpage in landscape mode where no previous, well known and tested, iOS trick would make it in order to have a better, full screen resolution.However, problems are the same in the portrait mode: there's no way, if you use any
overflow: auto;
or touch
in your page, to see the magic morph happening in the surrounding Safari Mobile UI.On top of this, when you apply or pay for Apple Beta Testing or Developer, you are under an NDA/EULA you can hardly report problems even to Apple itself since it's very easy to be in troubles even saying "hey, I've tested stuff here and didn't work" ... where the place is publicly reachable and you are showing premature problems... right?
... oh well, back to this post ...
ReIntroduction To Safari Mobile Full Screen
One example is usually better than thousands of words ... so here the example that will work as expected on iOS7 on iPod or iPhone, 'cause as Maximiliano said in his post, there's no way to obtain a proper full screen on iPad (but probably that ain't needed anyway).It's very important that you visit the example page before I can explain what is this about so please do it and come back after if the source code isn't explicative enough :)
Insert Coin, And Press Start!
Even if the Wikipedia definition is jurassic, since the splash screen has been used in Flash WebSite since ever and most of the time in a totally dynamic way, Apple gave us only one possibility to have a full screen on its devices: we need to teach the user how to reach a full screen experience!Actually Not So Bad As It Sounds
Thanks to CSSposition:fixed
and a background that keeps moving regardless in the OS itself, we could make the road to the full-screen playful and fun.Somehow, reaching the full screen in the phone through the browser could be used as leveling-up the user itself when it comes to a game.
In my example you can try to rotate, change, do things with the device, until you reach again the full screen possibility. Why couldn't this be an option? It works in both portrait and landscape too and we have an extra "bonus" for the playing user ^_^
As summary: isn't a playful splash screen a way less boring introduction to an app or game than just a static image, as native apps guys are used to these days? ;)
The Trick In A Nutshell
In order to be able to reach a full screen in iOS7, thebody
of the document
must have style.height = (screen.height + 1) + 'px';
, where the height
needs to be the width
once in landscape ... And that's pretty much it! Test This Page if you don't believe me, and you'll notice that just scrolling up in both portrait or landscape section you'll find yourself on a full screen.
Enjoy yet a new modern web era hack because we haven't learned yet that W3C APIs are there for good reasons and nothing bad would have ever happened simpyl following them rigorously.
Pssss, hey ... in portrait, just
screen.height
will do, without the plus one ... however, plus one puts the browser in a sort of "must go full screen" state so ... you've been warned ;-)
Is iOS7 Full Screen ?
If you'd like to go dirty and obtrusive with this approach, here a very simple functions that could help you instruct users when you recognize the screen is not full anymore:function iOS7isFullScreen() { return Math.abs(orientation) == 90 ? innerHeight == 320 : innerHeight == 529 ; }Feel free to adjust size if needed or use display to check when is necessary and not, as example, in a
setInterval
.