1

I have IE version 11.0.9600.17358

window.open('editProperties.php?fileid=661BEAB9735A615D65B3FCF676A2F83F', 'editProperties', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=570,height=580,left=490,top=362');

throws invalid argument error. I tried creating a test.html and calling it just by name:

window.open('test.html')

it does not work, throws the same error. Only time I was able to use it was as:

window.open('', 'editProperties','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=570,height=580,left=490,top=362')

or

window.open('about:blank')

As soon as I pass a url as the first argument, it throws the error. Anyone has any ideas?

PersyJack
  • 1,736
  • 1
  • 21
  • 32
  • I'm pretty sure you have to pass in the full URL, starting with http(s). – Halcyon Dec 11 '14 at 15:31
  • For more info see https://developer.mozilla.org/en-US/docs/Web/API/Window.open – Huangism Dec 11 '14 at 15:36
  • @Halcyon I've already tried passing window.open('https://internal.website.com/editProperties.php?fileid=661BEAB9735A615D65B3FCF676A2F83F', '','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=570,height=580,left=490,top=362'); – PersyJack Dec 11 '14 at 15:39
  • @Huangism I've already read that. I've passed full url, I've made sure the name argument does not have any space or weird characters. – PersyJack Dec 11 '14 at 15:41
  • @PersyJack can you reproduce this on a http://jsfiddle.net ? I tried your script and it works fine on my IE 11 VM. Are you 100% sure the error is coming from window open? – Huangism Dec 11 '14 at 15:43
  • The code works as it is, the error has to be thrown from somewhere else, or there's something you are not showing us. – Teemu Dec 11 '14 at 15:43
  • You specifically mention IE - does it work correctly in other browsers? – James Thorpe Dec 11 '14 at 15:44
  • @JamesThorpe yes it does. Chrome and firefox work as expected. For the sake of the argument, I've tried calling window.open('http://stackoverflow.com/questions/27426401/window-open-is-throwing-invalid-argument-error-in-ie', '', 'width=500px') from the console and it work. So I guess something wrong with the server settings, I'm not sure – PersyJack Dec 11 '14 at 15:47
  • Your fist line runs for me http://jsfiddle.net/g9jv1fyx/ – Huangism Dec 11 '14 at 15:47
  • Thanks for the comments guys. I'll investigate the server side. Maybe because it's https – PersyJack Dec 11 '14 at 15:49
  • Just found [this question](http://stackoverflow.com/questions/710756/ie8-var-w-window-open-message-invalid-argument) - potentially a duplicate? Looks like the window name is the issue in IE. – James Thorpe Dec 11 '14 at 15:53
  • @JamesThorpe `editProperties` is a valid window name. – Teemu Dec 11 '14 at 15:57
  • @Teemu That's correct, it should open it without passing the full path. The example I gave to JamesThorpe works (opening this page in a popup). So I know it's not internet explorer's fault. However, it doesn't produce any error on other browsers, they just work. – PersyJack Dec 11 '14 at 16:00
  • @Teemu Yeah - just wanted to highlight it in case this wasn't a direct copy/paste of the code with the issue, and the original code may have had some invalid (as far as IE is concerned) characters in the name – James Thorpe Dec 11 '14 at 16:04
  • @JamesThorpe Yes, that's possible (or in the URL as well), but even `about:blank` is not working ... – Teemu Dec 11 '14 at 16:12
  • @Teemu I read it that `about:blank` and empty URL was working? – James Thorpe Dec 11 '14 at 16:13
  • Guys it was something to do with windows authentication or session, I'm not really sure but opening another tab fixed the issue. I have no clue. – PersyJack Dec 11 '14 at 16:14
  • @JamesThorpe Yeah, my bad. Anyway, looks like OP has a clue now, it seems to be something, which is not posted. – Teemu Dec 11 '14 at 16:14
  • @Teemu Yep. Wierd error to throw if it's an authentication issue! – James Thorpe Dec 11 '14 at 16:15

2 Answers2

0

Just pass the name parameter, as for example:

window.open('/somefile.html', '', 'width=300');

Maybe in this StackOverflow answer you shall find more details.

Community
  • 1
  • 1
Giacomo Paita
  • 1,411
  • 2
  • 12
  • 21
0

Oh wow, I've opened another tab, which asked me my credentials again, after entering it, the same exact link just worked. It seems like the session timeout or something but still showed me the page between loads. If anyone encounters this error and none of the comments above work, try opening a new tab!! Thank you all for trying to resolve my issue.

PersyJack
  • 1,736
  • 1
  • 21
  • 32