majmun
majmun

Reputation: 11

window.open() in IE 9

when i try to window.open() in IE 9 , it opens it with favorites sidebar (if it was present in parent window) this is behaviour unique to IE , and it breaks dialog windows as I envisioned them. Any hope to fix that?

Upvotes: 1

Views: 3176

Answers (2)

Kris
Kris

Reputation: 8868

Try changing it to window.location.href= 'url + target="_blank"'

Upvotes: 0

Spudley
Spudley

Reputation: 168655

Since you specified that you're using this for a dialog, I feel I should discourage this. Using window.open() is not ideal for creating dialog boxes.

  • Some browsers will ignore your 'new window' request, and open it as a new tab. This can be configured by the browser user, so is out of your control.

  • If the user has toolbars and side panels open, there's a strong likelyhood of them showing up in the new window, which will mangle your layout. Again, you'll need to test this in every browser, and even then you can't be sure without knowing all the config options that might affect it.

  • Opening a new window does not give you a modal dialog box. You can't prevent the user from clicking back to the parent window and ignoring the dialog box.

Therefore, if you want to make a dialog box, you would be much better off using a javascript library that opens a box inside the current page. It's much more flexible, and gives you much more control over the end result than window.open().

If you're using JQuery, you might want to start by looking here: http://choosedaily.com/1178/15-jquery-popup-modal-dialog-plugins-tutorials/, but there are stacks of others available (it's a very easy thing to write, especially in JQuery, so there's plenty of plugins out there you can try till you find one which is perfect for you)

Upvotes: 1

Related Questions