Solved

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

Posted on 2003-10-29
12
165,145 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

752 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