Search code examples
javascriptopendialog

"SecurityError: The operation is insecure." in firefox and "Uncaught ReferenceError: openDialog is not defined" in chrome


I tried

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

and

openDialog('http://localhost');

Both throw an exception:

  SecurityError: The operation is insecure

in firefox and

 Uncaught ReferenceError: openDialog is not defined

in chrome

openDialog() is not available in all browsers?

I am working on a local machine.


Solution

  • 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.

    So, If you are not using the additional arguments use something like :

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

    or simply

    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).

    So yes, nothing possible for the titlebar or close button.