Reputation: 43
Is there any way IE can be closed programmatically?
I am trying to build a simple login system for the school I am working at in which a pupil would sign in using a HTML form and when they click the submit button the window will close automatically.
I have tried this using JavaScript (close() seems to be redundant now), VBScript (.Quit) and trying to run a .cmd file to close it externally (Windows Script Host). None of these have worked.
I am not doing this maliciously and I have absolutely no bad intentions of using this code. I understand that it is a universal standard for web browsers not to be closed by client/server side scripts. But, I am, nonetheless, wondering whether this would be possible and how (preferably without installing any other applications).
Upvotes: 2
Views: 893
Reputation: 11
Is there any way IE can be closed programmatically?
Sure. Find the right IE instance in the SHELL.WINDOWS collection, then QUIT that instance. Or find the right process in Win32_Process, then TERMINATE that process. Or probably dozens of other ways.
None of which will necessarily help, unless you provide a ton more information about what you are actually doing! But that's the consequence of asking "Can I do 'X'?", instead of: "I need to achieve result 'Y', what is the best way to do that?"
You've told us 'X', but not 'Y'.
Upvotes: 1
Reputation: 114347
JavaScript cannot close windows that were not opened via JavaScript.
If websites could close people's browsers, a lot of people would be angry. Your non-malicious intent is unknown to the browser.
Upvotes: 0