69

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

animuson
  • 53,861
  • 28
  • 137
  • 147
Anbu
  • 953
  • 3
  • 10
  • 16
  • 3
    In modern Firefox such folly does not work. – Nicolas Barbulesco Dec 21 '13 at 09:48
  • Firefox 3 note In Firefox 3, dom.disable_window_open_feature.location now defaults to true, forcing the presence of the Location Bar much like in IE7. See bug 337344 for more information. So below firefox 3 only hiding of the location bar works. – Emmanuel Angelo.R Jul 11 '14 at 04:51
  • This doesn't work either in MS Edge ... All these parameters and other window features are just ignored. – Apostolos Mar 10 '21 at 09:58

6 Answers6

91

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');
Intelekshual
  • 7,444
  • 1
  • 21
  • 28
  • thanks for your answer As you said it is disabled by firefox – Anbu May 26 '10 at 20:21
  • 1
    @Intelekshual Title bar not hidden. Checked in IE,FF,Chrome and Opera – SCC Mar 08 '14 at 08:56
  • Could you have a look at this: http://stackoverflow.com/questions/25703925/how-to-open-tel48123-link-client-side-without-openning-new-window-tab-in-bro – Yoda Sep 06 '14 at 19:57
20

I agree we can not hide address bar in modern browsers, but we can hide the URL in address bar (e.g show URL about:blank). The following is my work around solution:

var iframe = '<html><head><style>body, html {width: 100%; height: 100%; margin: 0; padding: 0}</style></head><body><iframe src="https://www.w3schools.com" style="height:calc(100% - 4px);width:calc(100% - 4px)"></iframe></body></html>';

var win = window.open("","","width=600,height=480,toolbar=no,menubar=no,resizable=yes");
win.document.write(iframe);
Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
PARAMANANDA PRADHAN
  • 1,104
  • 1
  • 14
  • 23
18

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

Zefira
  • 4,329
  • 3
  • 25
  • 31
catchmeifyoutry
  • 7,179
  • 1
  • 29
  • 26
  • 4
    Title bar not hidden. Checked in IE,FF,Chrome and Opera – SCC Mar 08 '14 at 08:54
  • 2
    location bar not hidden – user2568374 Nov 10 '16 at 20:01
  • Not only I checked **https://developer.mozilla.org/en-us/docs/Web/API/Window/open** but I also tested the window features: using `windowFeatures = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes"` or `windowFeatures = "menubar=no,location=no,resizable=no,scrollbars=no,status=no"` makes absolutely no difference, i.e. the result is exactly the same. – Apostolos Mar 10 '21 at 10:01
12

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

Gaurav Gupta
  • 5,380
  • 2
  • 29
  • 36
3

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.

Vu Dang
  • 721
  • 1
  • 7
  • 11
0

check this if it works it works fine for me

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);
}

openRequestedPopup();
Ruslan López
  • 4,433
  • 2
  • 26
  • 37
Php developer
  • 446
  • 4
  • 18
  • 4
    No, this does not work, at least not in current Firefox. Menubar and srollbars are disabled, but the address bar still appears, and the window is still resizable. – sleske Aug 05 '13 at 08:44