【问题标题】:"SecurityError: The operation is insecure." in firefox and "Uncaught ReferenceError: openDialog is not defined" in chrome“SecurityError:操作不安全。”在 Firefox 和 Chrome 中的“未捕获的 ReferenceError:openDialog 未定义”
【发布时间】:2013-02-22 11:52:37
【问题描述】:

我试过了

openDialog('http://stackoverflow.com');

openDialog('http://localhost');

两者都抛出异常:

  SecurityError: The operation is insecure

在火狐和

 Uncaught ReferenceError: openDialog is not defined

在铬中

openDialog() 并非在所有浏览器中都可用?

我在本地机器上工作。

【问题讨论】:

  • MDNNot part of any standard.

标签: javascript opendialog


【解决方案1】:

window.openDialogwindow.open 的扩展。它表现为 相同,只是它可以选择过去的一个或多个参数 windowFeatures 和 windowFeatures 本身被处理了一点 不同。

所以,如果您不使用附加参数,请使用类似:

window.open(
   "http://localhost",
   "DescriptiveWindowName",
   "resizable=yes,scrollbars=yes,status=yes"
 );

或者干脆

window.open("http://localhost");

如果使用 strWindowFeatures 参数,则未使用的特征 列出的将被禁用或删除(标题栏和关闭除外 默认是yes)。

所以是的,标题栏或关闭按钮不可能。

【讨论】:

  • 我想要一个简单的窗口。不想要标题栏、菜单栏等任何装饰或尽可能减少装饰。
  • @habeebperwad 看看我的编辑,不会有滚动/状态栏。还可以访问 window.open 链接,您可以找到打开新窗口时可以控制的所有功能的列表...
  • @habeebperwad 在窗口功能字符串中添加“toolbar=yes”
  • 地址栏我也不要了。
猜你喜欢
  • 2016-05-04
  • 2012-11-01
  • 2013-04-28
  • 2019-01-28
  • 1970-01-01
  • 2012-05-26
  • 2020-04-03
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多