Ask coding questions

← Back to all posts
How do I make it close the window in a script
IL2PG2021 (18)

In index.html you see window.close() ? That does not work, how do I make it close the window on command

Comments
hotnewtop
InvisibleOne (2681)

Like notGilbert said, you can't close a window in js unless you first trick it into thinking it opened the window. You can read more about it here: https://stackoverflow.com/questions/23306882/javascript-close-current-window

notGilbert (92)

Unless the window is opened by a window.open, it is not possible to close the window through JavaScript,

maybe blank the screen or show a not authorized message?

[deleted]

@notGilbert mk ty for suggestion