Browser Close not working for HTML5 export

0 favourites
  • 6 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • I know its been posted about before but I can't find the answer on here.

    I have a Browser Object and the Action Close when the user hits a button. But it won't close when I make an HTML5 build and upload to a server. I read that you needed a secure server and I indeed have https:// before my URL but it does not work to close the TAB.

    What am I doing wrong?

  • Probably worth looking at https://developer.mozilla.org/en-US/docs/Web/API/Window/close as that's the API which we use for Browser.Close in HTML5 exports.

    The obviously looking restriction is that it only works if the current window was spawned as a child of another window.

    This matches what the documentation says

    Security limitations sometimes prevent browser actions. For example, the window Close action can only be used when the window was created by a JavaScript window.open call.

  • Nepeo well thats the problem then. I'm just going to the web page by clicking a new browser tab. Is that why people run their games in an iFrame?

  • It's a reason I guess, although I'm not sure if an iframe is an actual workaround in this situation. There's a JS API window.open which creates a child window, either as a tab or a popup. That would be the standard use for this. I'm not entirely sure what your aiming for with this, but closing the iframe ( not the tab containing it ) doesn't sound that useful for you?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Nepeo oh right, that makes sense. Basically I have a game at a specific URL. They can go fullscreen. When they are done with said game, I'd like them to be able to exit. But it doesn't look like that's possible.

  • You could set it up so that the page that links to the game opens it in a new window? Doesn't stop people copy pasting the URL but probably covers most situations.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)