Browser 'Close' not working in Firefox

Bugs will be moved here once resolved.

Post » Tue Apr 10, 2018 10:43 am

Problem Description
The browser object cannot close the browser window in Firefox. It works instantly in chrome, works with a warning in IE, but nothing happens in Firefox.

Attach a Capx
https://nofile.io/f/ThYXrAMzH27/FirefoxCloseBroken.capx

Description of Capx
Press the button, and the window should close.

Steps to Reproduce Bug
  • Add the browser object to a new project.
  • Add a button with On Click -> Browser: Close
  • Run the project and click the button.

Observed Result
Nothing

Expected Result
The browser window instantly closes.

Affected Browsers
  • Chrome: NO
  • FireFox: YES - 59.0.2 (64-bit)
  • Internet Explorer: NO

Operating System and Service Pack
Win 7 SP2 64-Bit

Construct 2 Version ID
r256 64-bit
B
23
S
6
G
3
Posts: 83
Reputation: 3,037

Post » Tue Apr 17, 2018 1:52 pm

The .capx link is 404, so closing.

Further, whether or not JavaScript has permission to close the browser window depends on the browser and circumstances. Usually it can only close popup windows that were also opened by script. Otherwise browsers may block the close call in order to avoid web pages annoying the user by self-closing tabs or windows when they don't want them to.
Scirra Founder
B
415
S
248
G
92
Posts: 25,284
Reputation: 200,952

Post » Wed Apr 18, 2018 2:28 am

Hey, thanks for replying. A couple things come to mind that make me question whether this should be closed or not.

If this is being closed because the capx link has expired, I can repost it. My fault; I didn't realize those links expired so soon. (You don't really need the capx; it can be done in any capx by adding a button with browser -> close, and running it in firefox.)

But more importantly, how do you make a browser game "quit" function without calling Browser -> Close? Or put another way, why is Browser -> Close an option in the Browser plug-in if it's inconsistent in different browsers? If the point of the feature is to close the window, but it doesn't always work, what's the valid use case for it?

I may have this wrong. But it seems strange to have a feature that depends on the browser; naturally people aren't developing just for Chrome with HTML5 games.
B
23
S
6
G
3
Posts: 83
Reputation: 3,037

Post » Wed Apr 18, 2018 9:04 am

It's there in case you are using a popup window, and it works on other platforms like Android where it does make sense to quit. You can't really "quit" a browser tab though, the user is in control of that.
Scirra Founder
B
415
S
248
G
92
Posts: 25,284
Reputation: 200,952

Post » Wed Apr 18, 2018 11:06 am

Ah ok, understood. The idea was to use it in fullscreen game; having a quit option that closed the browser was more elegant than using Cancel Fullscreen, and then letting the user do it.

Thanks for the reply.
B
23
S
6
G
3
Posts: 83
Reputation: 3,037


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 4 guests