Is it possible for an HTML5 app to close its own browser tab?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Charlie

Here’s our functioning web app for context:

Well, we can ask to open a new browser window with OS.shell_open(). But I can’t find a way for our HTML5 web app to close its own window on quitting. SceneTree.quit() just freezes the sim, leaving window open on a non-functional app.

Appreciate any help you have for me!

:bust_in_silhouette: Reply From: RazorSh4rk

JavaScript.eval("window.close()") should work.


It works! Thanks!

I did need a test to avoid doing that in non-HTML5 build (otherwise it locks up the cmd line for some reason):

if OS.has_feature('JavaScript'):

Charlie | 2020-05-22 01:03

You’re welcome :slight_smile: I really like this project btw

RazorSh4rk | 2020-05-22 10:01

Thank you for the project compliment! I’d really like to see other developers get involved!

Charlie | 2020-05-23 01:00