I'm writing an extension using ATL/COM.

When clicking on the button, a new browser window with a form pops up, and when the form is submitted, the server returns a page to close the window using javascript window.close method.

The pop up window is created through CoCreateInstance function, and thus when window.close is called from script, the browser prompts the user whether let the script close window or not. Yes we can set window.opener to null in ie6, but this no longer works in ie7.

I tried to process the WindowClosing event, but it seems only be fired when the window being closed by script is created by script.

I looked at del.icio.us's script in the pop up window, and found that they're just using one line: window.close().

What should I do to achieve the same effect as del.icio.us Any help is appreciated.

Re: Internet Explorer Extension Development window.close in javascript


Depending on how exactly you've created the popup, you could hook up a custom window.external implementation and then create a window.external.MyClose() method that your script calls into.

Re: Internet Explorer Extension Development window.close in javascript


window.external is a bit complex.

Is there anyway to popup a new window in the code, and make the system think it's created by scripts (then it can be closed by window.close)