IE prevents Window.close()

NetRock6 used Ask the Experts™
Hi ..
After running a script the below IE11 pops out the below message:
The web page you are viewing is trying to close the window. Do you want to close this window? Yes|No
I tried different settings in the security tab like:
"Display Mixed Content"
"unchecked "Enable protected mode"
But none help so far. Does anyone know what option i need to change to prevent the popup.
Your Quick Prompts Highly Appreciated.

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Internet options - Security - Trusted sites - Sites
Uncheck Require server verification (https:) for all sites in this zone
Adding http://* fixed my problem.

Change http://* to problem domain in question.

reference :
Chinmay PatelChief Technology Ninja
Distinguished Expert 2018

Hi NetRock6,

Your script didn't make it. Please update the question with it.

Should you be charging more for IT Services?

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Zakaria AcharkiAnalyst Developer
Distinguished Expert 2018


Nothing to do by changing the settings.
Use this:
function quitBox(cmd)
    if (cmd=='quit')
        open(location, '_self').close();
    return false;  
Sam JacobsDirector of Technology Development, IPM

The attached works for IE and Edge (but not Firefox and Chrome).
If you have other code that works for those browsers, maybe you can do a browser sniff and branch as needed.


Thank you All for your help.

That is a great workaround. How does it work in a hta script 'window.close()'.

Director of Technology Development, IPM
It works for an .hta as well ... please see attached (remove the .txt extension).

Even is basically the same as mine, it's work well.The idea is to load self and close it. Another is to first empty the inner and next close,because an empty element are not throwing the page protection routine.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial