Mobile Safari - Frame/Window scaling (cc 2.3.3 -> 2.4.2)


When creating a web game with CC2.3.3 I have a DIV container where I want the game to fit into and scale within and not leak outside it. It works good on every device except Safari Mobile. I dig into the engine and saw this:

On mobile safari it uses window.innerHeight and window.innerWidth instead of the parent DIV container to calculate the size of the game, which causes it to leak outside and also the whole canvas-element to fill the whole screen (which is not what I want).

I can of course create a custom engine (which is not optimal), but there is a comment about // bug fix for navigation bar on Safari. What does this fix do? Why was this added here?

I see that in CC 2.4.2 it looks like this:

I cannot currently upgrade to CC 2.4.2 due to a lot of breaking changes with cc.loader, but will do it later. Just need to understand what this bugfix was and how it has been countered in later versions of cocos creator.


it’s a bug fix for versions before iOS13, the safari navigation bar will block the game screen

but now it’s not needed, so we removed this bug fix on v2.4.0

1 Like

Thanks @PP_Pro for your response! :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.