Anbu
Anbu

Reputation: 953

Open new popup window without address bars in firefox & IE

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

Upvotes: 69

Views: 433243

Answers (6)

Php developer
Php developer

Reputation: 456

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

Upvotes: 0

PARAMANANDA PRADHAN
PARAMANANDA PRADHAN

Reputation: 1169

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

Upvotes: 20

catchmeifyoutry
catchmeifyoutry

Reputation: 7369

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

Upvotes: 18

Vu Dang
Vu Dang

Reputation: 721

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.

Upvotes: 3

Gaurav Gupta
Gaurav Gupta

Reputation: 5416

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

Upvotes: 12

Intelekshual
Intelekshual

Reputation: 7566

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

Upvotes: 92

Related Questions