Closing browser window from button in perspective?

Does anyone know of a way to close a browser window from a button in perspective?

That’s unlikely to be possible other than on a popup.

I am curious as to why this wouldn’t be possible.

It’s probably browser security.

Have you seen any website where you can press a button on the page to close the browser window or tab? If a web page was allowed to do that then a bit of Javascript could close any other tab, etc.

@Transistor I have seen it done with javascript before, but maybe that was just in a pop-up.

Browsers only allow you to close via Javascript a window/tab that was itself opened via Javascript:

@PGriffith So if I were to call a perspective session via javascript, I should be able to close it using this method?

In theory. In practice, it’d still require a custom module. We’re not exposing the ability to call Window.close(), and we don’t have anywhere for you to author your own JS that runs on the frontend session (deliberately).

We might add it first-party someday, but it would have some very confusing semantics (sometimes it would work, sometimes it wouldn’t) that are probably the reason it hasn’t been implemented.

1 Like