开发者

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??


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:

  • Haissam - Close window without the prompt message in IE7
  • Close Window in IE from javascript (Comment 37)


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜