Is there a way to exit a tab without window.close()?

Please Note: The TotalFreedom Forum has now been put into a read-only mode. Total Freedom has now closed down and will not be returning in any way, shape or form. It has been a pleasure to lead this community and I wish you all the best for your futures.
  • To elaborate on my question,

    I am working on a nodejs server that runs a simple https website. I want it to look and feel like an actual application rather than a website and have setup a batch file to open the node server and the edge browser in kiosk mode. Currently, the user has to CTRL + W the browser and CTRL + C the server to shut off the application. I want to implement a system that, when ESC is pressed, shuts down the server and exits the current tab. Currently, I have a system that redirects the user to localhost/shutdown when ESC is pressed. NodeJS has a /shutdown endpoint that serves the user public/shutdown.html and then, after 2 second, exits the process.

    Now, all I need to do is close the localhost/shutdown tab once the server has properly shutdown. After some quick searching I found the window.close() function - a function of which, due to a security patch, was no longer able to close just any tab. The windows.close() function is only able to close a tab that the same script created. Because of this, I shouldn't be able to close my webpage. After a quick test, I got the Scripts may close only the windows that were opened by them error, thus ending my short burst of hope that I had found an easy way out of my dilema. I have attempted to have nodeJS open a new index.html which would then open the popup tab of the game. This would enable me permission to exit out the popup tab with (newtab).close() as it was my script that opened it. I realized that, even if I was able to close this new popup tab, I would always have one original tab unable to automatically close because it was not my script that had opened it. All of this is just to create a clean closing effect that saves the user the need to close out both the tab and the server - so not needed, but would look cool. If anybody has knowledge about how I could do this I would love to hear some feedback.

    Thanks!

  • @Folfy_Blue#18967 Yeah, that opens a tab which does allow me permission to close it via js, however, the original tab will still be open. I am trying to get a clean exit process setup to replace the current CTRL + W, CTRL + C to close the tab and the node app manually. This requires that all tabs are closed. This solution just opens a tab and closes it right after.

    I ran into this same problem lmao

  • @burger#18976 Well then you can't really, this is a security feature so that some rogue extension or malicious website doesn't block you out of your browser or "crash" it

    A fool's fool fools fools who foolishly accept the foolishness of a fool's fool.