0
\$\begingroup\$

I have built my game and hosted it on itch.io. it works well on PC browsers and on the mobile Android browser.

The problem appears when I try to launch it on an iOS phone: the game won't go into full screen (it's supposed to go into it automatically). I added a button that's supposed to switch to full screen but it doesn't respond (the button does work on PC and Android though).

\$\endgroup\$
3
2
\$\begingroup\$

It looks like you've encountered a limitation of Safari for iOS, where the Fullscreen API is largely unsupported, being usable only for iPad devices running iOS 12 or later (MDN, caniuse).

Safari users on iPhone and iPod devices will be unable to take advantage of true fullscreen functionality, though you can get quite close by prompting users to add your web application to their home screen and applying specific <meta> tags to your page. You'll also want your game to span the entire content of the web page. From the great answer here:

<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="viewport-fit=cover, user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">

Outside of the above, one can reduce the visibility of Safari UI – completely hiding it when in landscape – through certain interactions such as scrolling. See this answer for more details on how to make clever use of this. (Previously this could be done programmatically, though Apple's patched that option for now.)


Note: in the past, this functionality could be enabled for iPhone/iPod devices through Safari's advanced settings pane (Settings > Safari > Advanced > Experimental Features > Fullscreen API), though this is unfortunately no longer the case.

Related, somewhat dated (iOS 6) question: https://stackoverflow.com/questions/12822739

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.