【问题标题】:window.open is throwing invalid argument error in IEwindow.open 在 IE 中抛出无效参数错误
【发布时间】:2014-12-11 15:27:59
【问题描述】:

我有 IE 版本 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');

抛出无效参数错误。我尝试创建一个 test.html 并仅按名称调用它:

window.open('test.html')

它不起作用,抛出同样的错误。只有一次我能够使用它:

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

window.open('about:blank')

只要我将 url 作为第一个参数传递,它就会抛出错误。有人有什么想法吗?

【问题讨论】:

  • 我很确定你必须传入完整的 URL,以 http(s) 开头。
  • @Halcyon 我已经尝试过传递 window.open('internal.website.com/…', '','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0, resizable=1,width=570,height=580,left=490,top=362');
  • @Huangism 我已经读过了。我已经传递了完整的 url,我已经确保 name 参数没有任何空格或奇怪的字符。
  • @PersyJack 你能在jsfiddle.net 上重现这个吗?我试过你的脚本,它在我的 IE 11 VM 上运行良好。您是否 100% 确定错误来自打开的窗口?

标签: javascript internet-explorer window.open


【解决方案1】:

传递name参数即可,例如:

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

也许in this StackOverflow answer你会找到更多细节。

【讨论】:

    【解决方案2】:

    哇哦,我打开了另一个选项卡,它再次询问我的凭据,输入它后,完全相同的链接就可以工作了。看起来像是会话超时或其他东西,但仍然向我展示了加载之间的页面。如果有人遇到此错误并且上述 cmets 均无效,请尝试打开一个新选项卡! 感谢大家尝试解决我的问题。

    【讨论】:

      猜你喜欢
      • 2011-08-13
      • 1970-01-01
      • 2011-06-17
      • 1970-01-01
      • 2019-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多