4 ms·
> The only thing missing is that I can't close the tab using JavaScript when it's finished, so the user (usually me) has to close it himself. how come? doesn't
by y4mi 5y ago
> The only thing missing is that I can't close the tab using JavaScript when it's finished, so the user (usually me) has to close it himself.
how come? doesn't window.close() work for you?
save(event) {
...take the action you wanted...
window.close()
}
<button onclick="(event) => save(event)">
- abdusco 5y agoThat only works for popup windows (ones created with `window.open()`) [0]. From MDN: > This method can only be called on windows that were opened by a script using the Window.open() method. I was unable to get `window.close()` to work on root windows, but your comment prompted me research it again. This seems to work: window.close('','_parent','') [0]: https://developer.mozilla.org/en-US/docs/Web/API/Window/close https://developer.mozilla.org/en-US/docs/Web/API/Window/clos...