Jump to content

Hide Safari address bar on iOS 6 in Construct 2


K1kk0z90
 Share

Recommended Posts

Hi all! :)
I'm trying to hide address bar on iOS 6.1.5 in a Scirra Construct 2 project. I know this is a trivial task, and I managed to do it with GameMaker, but for some reason I can't make it work here.
Here's what I'm doing:

On start of layout:

  • Browser: Execute Javascript
    if (!document.getElementById('space')) {   var space = document.createElement('div');   space.style.height = '60px';   space.style.clear = 'both';   space.id = 'space';   document.getElementsByTagName('body')[0].appendChild(space);}
  • Browser: Execute Javascript
    if (window.location.hash.indexOf('#') == -1) {   setTimeout(function() {        window.scrollTo(0, 1);    }, 0);}

When the page loads for the first time, it works perfectly. However, after the page has been refreshed, what happens is that the address bar still hides, but the canvas doesn't take all available space, but there is a blank space at the bottom of 60px (the height of the bar, and the height of the div I add to the page to increment space).

What am I doing wrong? Thank you in advance! :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...