Open new popup window without address bars in fire

2019-01-01 09:39发布

问题:

hope someone can help. just cannot get a new window to open in Firefox without address bars. IE works fine with below code

window.open(\'/pageaddress.html\', \'winname\', 
  directories=0,titlebar=0,toolbar=0,location=0,status=0,     
    menubar=0,scrollbars=no,resizable=no,
      width=400,height=350);

I need to make for all browser

回答1:

Firefox 3.0 and higher have disabled setting location by default. resizable and status are also disabled by default. You can verify this by typing `about:config\' in your address bar and filtering by \"dom\". The items of interest are:

  • dom.disable_window_open_feature.location
  • dom.disable_window_open_feature.resizable
  • dom.disable_window_open_feature.status

You can get further information at the Mozilla Developer site. What this basically means, though, is that you won\'t be able to do what you want to do.

One thing you might want to do (though it won\'t solve your problem), is put quotes around your window feature parameters, like so:

window.open(\'/pageaddress.html\',\'winname\',\'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=400,height=350\');


回答2:

Check the mozilla documentation on window.open. The window features (\"directory=...,...,height=350\") etc. arguments should be a string:

window.open(\'/pageaddress.html\',\'winname\',\"directories=0,titlebar=0,toolbar=0,location=0,status=0,menubar=0,scrollbars=no,resizable=no,width=400,height=350\");

Try if that works in your browsers. Note that some of the features might be overridden by user preferences, such as \"location\" (see doc.)



回答3:

Workaround - Open a modal popup window and embed the external URL as an iframe.



回答4:

In internet explorer, if the new url is from the same domain as the current url, the window will be open without an address bar. Otherwise, it will cause an address bar to appear. One workaround is to open a page from the same domain and then redirect from that page.



回答5:

check this if it works it works fine for me

<script>
  var windowObjectReference;
  var strWindowFeatures = \"menubar=no,location=no,resizable=no,scrollbars=no,status=yes,width=400,height=350\";

     function openRequestedPopup() {
      windowObjectReference = window.open(\"http://www.flyingedge.in/\", \"CNN_WindowName\", strWindowFeatures);
     }
</script>