How to hide address bar using javascript window.open?

VolleyBall Player picture VolleyBall Player · Apr 14, 2011 · Viewed 94k times · Source

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

Answer

SavoryBytes picture SavoryBytes · Apr 14, 2011

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.