我试过了
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/