I want to disable the address bar using javascript window.open
.
Also the script should work in IE, Safari and chrome. Any suggestions.

- 90,639
- 22
- 233
- 295

- 710
- 3
- 11
- 27
-
3As you probably know, there are the well known `location=no`, `addressbar=no` etc, but not all browsers follow this. Some of this is because of security reasons. – Christian Apr 14 '11 at 14:48
-
7Since the release of Firefox 3 it is not possible to hide the address bar. The option dom.disable_window_open_feature.location is by default set to true. As Christian mentioned, some browsers have strict rules when it comes to security. – Rafael Apr 14 '11 at 14:50
4 Answers
location
is the window feature you want to set to no
or 0
to hide the address bar.
Opinionated Advice: You can't rely on popups showing because most people have popup blockers installed to curb abuse, so if you can get away with it, don't use a pop up at all! Use something like the jQuery UI Dialog plugin.
Example:
window.open("http://www.mydomain.com/mypage.htm", "mywindow", "location=0,menubar=0,status=0,scrollbars=0,width=100,height=100");
Format
window.open( [Url] [, Name] [, Features] [, History] )
Window features you can control
- status The status bar at the bottom of the window.
- toolbar The standard browser toolbar, with buttons such as Back and Forward.
- location The Location entry field where you enter the URL.
- menubar The menu bar of the window
- resizable Allow/Disallow the user to resize the window.
- scrollbars Enable the scrollbars if the document is bigger than the window
- height Specifies the height of the window in pixels. (example: height=’350′)
- width Specifies the width of the window in pixels.

- 35,571
- 4
- 52
- 61
-
Thanks for clear explanation. some attributes like location, status, resizable, etc works only in IE but didn't in other browsers like FF, Chrome. – Srinivasan.S Jan 08 '14 at 10:11
(untested)
function openWindow(){
var browser=navigator.appName;
if (browser==”Microsoft Internet Explorer”)
{
window.opener=self;
}
window.open(‘filename.htm’,'null’,'width=900,height=750,
toolbar=no,scrollbars=no,location=no,resizable =yes’);
window.moveTo(0,0);
window.resizeTo(screen.width,screen.height-100);
self.close();
}
Got this from http://saher42.wordpress.com/2006/08/10/hiding-the-address-bar-on-pageload-using-javascript/.

- 2,692
- 3
- 20
- 27
-
This kind of code hasn't worked for a long time (since versions of IE7, at least). – Brock Adams Feb 22 '19 at 18:57
Also you have to enable window.open to hide the address bar in Firefox, which is disabled by default. Go to about:config
, search for disable_window_open
, so you can see all window.open feature disabling options, including dom.disable_window_open_feature.location
, which is responsible for the address bar not hiding. Set it to false
.

- 114
- 1
- 3
-
1This may not be the best answer for the OP, but it's exactly what I needed! Thanks. – shaneparsons Dec 09 '19 at 15:48
Type in the address bar of Firefox like this about:config,
search for disable_window_open, so you can see all window.open feature

- 11
-
The question was about how to disable address bar programmatically in Javascript. – Tomáš Kratochvíla Jul 16 '16 at 16:00
-
-