user254582
user254582

Reputation: 121

how to make the parent window close automatically in IE without popups?

hi i have written code for opening the child window with disabled toolbar and menu bar in IE. i have written the code in parent.jsp.

For IE version 8 the problem i face is it shows the pop-up saying

"Do you want to close the window ? Yes or No ".

I dont want to this pop-up to be shown in IE 8

the below code does not show the popup IE version 6, but its not working for IE 8

the code is

window.opener=top;
window.close();
window.open('link',toolbar=no,menubar=....);

can someone pls help me with a bit of code to not to show this popup and close automatically for all versions of IE??

Upvotes: 2

Views: 6943

Answers (2)

Richard Ev
Richard Ev

Reputation: 54117

You're running into a browser security feature - assuming that you're creating a site for public consuption, don't fight it.

Upvotes: 1

Daniel Vassallo
Daniel Vassallo

Reputation: 344301

In IE7 and IE8 you cannot close a window without the security warning, unless the window was previously opened programmatically with JavaScript. One possible workaround is to let the browser think that the parent window was opened programmatically. The following should silently close the parent window after opening the child window:

window.open('link', 'toolbar=no,menubar=...');
window.open('', '_self', '');
window.close();

Sources and further information:

Upvotes: 1

Related Questions