Close a Window in IE8 with ClientSide JavaScript RRS feed

  • Question

  • I need to find a snippet of javascript that can close an IE8 tab/window

    window.close() used to work.  From reading other post it seems in IE7 a prompt message would appear warning users a script was trying to close the window.  In IE8 even if I get the prompt that is OK...I just need to make a button to close the window/tab.  (This used to be a popup but ever since IE introduced tabbed browsing it became another tab.  Here are the solutions I have tried and consequently commented out. 

       //Closes a IE Tab in FF (IE 7.0)
               //Closes a IE Tab in FF (IE 6.0)
               //self.opener = this;
               //This will work for FF 3.x provide that in the about:config we set dom.allow_scripts_to_close_windows = true
               //without prompting
               //window.opener = self;
               //This will work for FF provide that in the about:config we set dom.allow_scripts_to_close_windows = true
               //but it will prompt
    Thursday, September 10, 2009 4:03 PM

All replies

  • Hi,

    I am using IE8

    I have a local html file, I open it through a .bat file.

    this html file has the javascript logic to open a popup IE window and it shud close itself.

    it is working very well on IE6, now we have migrated to IE8 and it comes up with 2 problems,

    1. while browsing local html file, it was showing security warning (restricted content, javascript, active x),

    I have solved this issue by using doctype and saved from tag to open it in internet security zone.

    2. while closing the local html file, it has started showing close window promt.

    now i have tried using


    but it did not close the local html file and gave "Access is denied" javascript error.


    Now the strange thing is, if put these two solutions separately it works fine, but if i put them together, I am getting error stated in point 2.




    Wednesday, May 4, 2011 9:23 PM