javascript - Firefox 中为 "SecurityError: The operation is insecure.",Chrome 中为 "Uncaught ReferenceError: openDialog is not defined"

标签 javascript opendialog

我试过了

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

openDialog('http://localhost');

两者都抛出异常:

  SecurityError: The operation is insecure

在火狐浏览器和

 Uncaught ReferenceError: openDialog is not defined

在 Chrome 中

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

我正在本地计算机上工作。

最佳答案

window.openDialog is an extension to window.open. It behaves the same, except that it can optionally take one or more parameters past windowFeatures, and windowFeatures itself is treated a little differently.

因此,如果您不使用附加参数,请使用类似以下内容的内容:

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

或者简单地

window.open("http://localhost");
<小时/>

If the strWindowFeatures parameter is used, the features that are not listed will be disabled or removed (except titlebar and close which are by default yes).

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

关于javascript - Firefox 中为 "SecurityError: The operation is insecure.",Chrome 中为 "Uncaught ReferenceError: openDialog is not defined",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15268539/

相关文章:

javascript - 使用子数组对数组进行展平和排序

javascript - 如何从派生自 Nan::ObjectWrap 的类返回 native 对象?

javascript - SAPUI5路由: Cannot read property 'initialize' of undefined

javascript - 是否可以使用 javascript 以编程方式在 Firefox 文件打开对话框中设置 "from:"字段

Electron :dialog.showOpenDialog不返回 promise 吗?

Delphi-如何获取目录中所有文件的列表

javascript - 在元素数组中查找重复的元素系列

javascript - 从 Meteor 中的另一个模板获取 react 变量