I am working on an Angular2 application. In this application, I want to provide a button to the user which when clicked will close the application and the browser tab in which it was opened.
I tried searching for the solution but didn't find anything much on it. One approach suggested was to call onDestroy for all the components to prevent any memory leak. However I don't have much concrete to go forward.
No you cannot as of now it is only possible in IE AFAIK and with chrome or firefox you will encounter error like this
app.component.ts:43 Scripts may close only the windows that were opened by it
You can look at this answer for more info https://security.stackexchange.com/questions/133744/why-do-browsers-disallow-script-closing-an-opener-window-yet-allow-changing-its
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With