Hide url adress bar

I’m trying to hide the browser address bar in mobile phones, so the game field can be bigger. So far I’ve got the bar hidden, but I’m unable to resize the canvas, and there’s a white space in the bottom of the screen with the size of the address bar. the code is the following:

function hideAddressBar() 
{
    if(navigator.userAgent.match(/iPhone/i))
    {
        var height = document.documentElement.clientHeight;
        height += 60;

        var body = document.getElementById("body");
        body.style.height = height + 'px';

        window.scrollTo(0,1);
   } 
} 

Any ideas on how to fix it?

Thanks in advance.


IMG_0001.JPG (221.1 KB)

Hi Albert,

Maybe you can add hideAddressBar() at line 131 of CCEGLView.js.

Dingping Lv wrote:

Hi Albert,
>
Maybe you can add hideAddressBar() at line 131 of CCEGLView.js.

That doesn’t seem to solve the problem. Maybe I should call it earlier or the problem is somewhere else. Any other ideas?

Hello Dingping,

I think this is very useful on mobile browser games, did you found any solution for this?

Thanks

This may be a dumb question, but for the sake of brainstorming:

what resolution policy are you using?

in my case fixedwidth.

Anyway, I think it’s something very useful that the engine could provide and avoid developers of doing ugly “hacks” :slight_smile:

This is a good suggestion.
Thank you, Jesus.

We will add this feature in version 2.1.6

good to know about this feature.

hi, was this feature finally added?