window.open opens two popup windows in IE

javascript, popupwindow

Solution

The problem is Internet Explorer executes the code as expected, but also displays the return value of `window.open` in a new document. Since `window.open` returns an object reference to the new document, this gets converted to a string - `[object Object]` - and is displayed.

To remedy this, you can add `return false` to prevent the browser returning anything.

<a href='javascript:window.open("http://endic.naver.com/search.nhn?query=In&searchOption=entry_idiom","Dictionary","width=500, height=500"); return false' target="_blank">Click me</a>

Edit - See OP's comment below this answer. The solution was to move the JavaScript to an `onclick` attribute, and to change the `target` attribute to be the same as the popup name.

<a href="javascript:void(0);" onclick='window.open("http://endic.naver.com/search.nhn?query=In&searchOption=entry_idiom","Dictionary","width=500, height=500");' target="Dictionary">Click me</a>

Problem

I'm getting a really strange behaviour in IE8. I have a simple javascript function to create a popup window. The popup window is created ok, but the parent window forwards to a completely blank window that just prints [object]. I have to hit the back button to get back to the original page. ``` <a href='javascript:window.open("http://endic.naver.com/search.nhn?query=In&searchOption=entry_idiom","Dictionary","width=500, height=500")' target="_blank">Click me</a> ``` There is no problem in Chrome, just IE. How can I get rid of this annoying behaviour?

Original source