Solved

Use javascript to remove/hide browser address bar or toolbar on the fly

Posted on 2003-10-29
12
164,822 Views
Last Modified: 2011-08-18
Does any body know of a way using JavaScript to remove or hide a browser's address bar or toolbar on the fly? You can obviously use a script to pop open a new window and set the properties of that window like so:
window.open(URL_of_new_window,window_handle,"toolbar=no,location=no,status=no,menubar=no,scrollbars=no");

However, I want a way to get rid of the menubar and toolbar on the click of a button, lets say. In other words, the pop up window has already been opened, displaying the menubar and tool bar. When the user clicks on a button or link in the window, though, the menubar/tool bar should disappear. Any ideas? Thanks!
0
Comment
Question by:luoshiben
12 Comments
 
LVL 25

Expert Comment

by:devic
ID: 9646566
no way
0
 
LVL 11

Expert Comment

by:Zontar
ID: 9646595
You can only do this when opening a new window, at the time the new window is opened, not later.
0
 
LVL 3

Accepted Solution

by:
superslamwich earned 125 total points
ID: 9647207
Wow that took a long time to edit.  Here's a mimic version that should create the desired effect:

<script type='text/javascript'>
<!--
  if(document.location.search != "")  {
    obj = document.location.search.substr(document.location.search.indexOf('?') + 1)
    address = (obj=="true") ? true : false ;
  } else {
    address=true
  }



  function toggleAddress(isvis)  {

    add = (address) ? "no" : "yes" ;

    if(isvis != "")  {
      add = isvis
    }
    q = (add=="yes") ? false : true ;
    if(q) {
      address=false
    } else {
      address=true
    }

    window.open("test5.html?" + address,"", "toolbar=" + add + ",location=" + add + ",status=" + add + "menubar=" + add +

"scrollbars=" + add);

    self.opener = ""
    self.close()
  }

//-->
</script>
<a onClick='toggleAddress("")'>Toggle</a>||<a onClick='toggleAddress("yes")'>With Address</a>||<a onClick='toggleAddress("no")'>No Address</a>

{Slam}

0
 
LVL 11

Expert Comment

by:Zontar
ID: 9647278
Well, it works -- however, just so you know, it does so by reloading the popup window.
0
 
LVL 3

Expert Comment

by:superslamwich
ID: 9647406
Like I said, it mimics the effect, because what luoshiben is asking for can't be done normally.  It's just a way around the limits :-)

{Slam}
0
 
LVL 11

Expert Comment

by:Zontar
ID: 9647610
I figured you knew that, Slam -- my remark was addressed to the original poster. :D
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 1

Author Comment

by:luoshiben
ID: 9647615
Thanks superslamwich- I couldn't think of a way to do it either without reloading the window, but your solution is a bit more efficient than what I would have done.
0
 
LVL 3

Expert Comment

by:superslamwich
ID: 9653333
Happy to help :-)

{Slam}
0
 
LVL 1

Expert Comment

by:Helixx
ID: 11384191
When i use this I just get
Toggle||With Address||No Address
in the same window.  What am i missing?
0
 
LVL 3

Expert Comment

by:superslamwich
ID: 11393088
Nothing, just click on whichever you want and it will switch.  I know I didn't make them links, I should have, but just click on them and they'll work

{Slam}
0
 

Expert Comment

by:gheatza
ID: 14686410
I am a noob in javascript and I dont understand how to integrate this script. can you give me a full script? if it is possible copy/past mode will be great
0
 
LVL 2

Expert Comment

by:hariprasadrj
ID: 22086572
Hi, its also works with IE7
window.open('some.html?',null,'toolbar=no,scrollbars=no,location=no,resizable =no,width=625,height=550,left=225,top=120');

thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now