?
Solved

Opening a Browser Window without toolbars

Posted on 2003-03-15
10
Medium Priority
?
367 Views
Last Modified: 2012-08-13
I want to open a browser window (NOT using the window.open method) without toolbars. Say for example, when I open IE and type www.hotmail.com, I would want the page displayed to be without toolbars and statusbar. Something like calling a function onpageload. Is there a way to do it?

Venky.
0
Comment
Question by:ramvenky
[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
10 Comments
 
LVL 17

Expert Comment

by:dorward
ID: 8141893
http://developer.irt.org/script/1022.htm

... but it looks like it only works in Netscape 4.x (thankfully, I hate it when sites muck about with my toolbars)
0
 
LVL 3

Expert Comment

by:superslamwich
ID: 8142582
The only way I can think of to do this is to close the window and open up the exact same window with no toolbars:

<script language='javascript'>
<!--
  re='/^(\w+)(\?ready)$/
  if(re.exec(self.location)) {
  }
  else  {
    window.open('','mypage.html?ready','toolbars=no')
    self.close() // Set mypage.html to the url of your page
  }
//-->
</script>



This script should do the job, but it is very annoying, and doesn't work great.  It has to ask permission before closing the page, and if I were you, I would leave the page alone
0
 
LVL 12

Expert Comment

by:lil_puffball
ID: 8142721
Rather than closing the previous page, send the user back where they were, so it really does seem as if they just opened another page:

<script language='javascript'>
function open() {
window.open('url.htm','name','toolbars=no')
history.go(-1)
}
</script>

<body onLoad="open()">
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 3

Expert Comment

by:superslamwich
ID: 8147862
There is one small problem with lil_puffball's solution above...

If you are loading the same page that that script is on, then every time it loads it will run the script.  It would open a window, which would open a window, which would open a window...

I do like the idea of going back in history instead of closing the window, but you would need to do one of two things to stop the loop:

(1)Open a different page then the one that first loads

--or--

(2)Add a variable such as the one in my script:

  re='/^(\w+)(\?ready)$/
  if(re.exec(self.location)) {
  }
  else  {
    // whatever solution you want to use
  }
0
 

Author Comment

by:ramvenky
ID: 8162086
Hmm....

What I actually wanted to do was, something like, when the user clicks on Internet Explorer, and opens my page, say venky.com, the page should be without any toolbars or statusbar. If i open a new window, it defeats the purpose, thats not what I want to do. And if I open a new window, and close the opener window, then Windows is going to prompt for a security question that is again annoying. So is there a way to open a window without toolbars in the firsplace?

something like this:

function removeBars() {
   self.toolbars = no;
   self.statusbar= no;
   return true;
}

<body onLoad="javascript:return removeBars();">

<!-- I know that this code is absolutely wrong in syntax, but I am interested in knowing, if something like this could be acheived. -->

Thanks a lot for your comments and suggestions.
0
 
LVL 3

Accepted Solution

by:
superslamwich earned 100 total points
ID: 8162442
I'm almost positive that there is no way to remove the toolbars onLoad, the only way to do it is to open another window.  I would use the way suggested by little_puffball and I:  Just opening a new window and sending the old window back one in history.  As far as I know, this is the only way to achieve something like what you want
0
 
LVL 12

Expert Comment

by:lil_puffball
ID: 8162825
ramvenky,
superslamwich is absolutely correct. There is no possible way to do this. This exact question has been asked and re-asked a million times with one answer: not possible. You MUST open a new window to have control over its settings. Doing this to an existing window violates users rights.

However, there are several alternatives. One I've already given you (open new window, send old window back).
Two. Open new window and close old window. BAD IDEA but possible. (I mean, it's possible to get no alert). Instead of self.close use self.opener=null;self.close();return false;
Again, I'd strongly recommend against this! THe preferred way is the first way.

Or, you could pop up a confirm asking the user if they would like to close the window. Example:

if(confirm('This page opens on a new window. Would you like to close this window or be sent back? Click
\'Yes\' to close or \'Cancel\' to go back.'))
{self.opener=null;self.close();return false;}
else
{history.go(=1)}

Or instead of history.go, you could use
else
{location.href=document.referrer}

Same thing.

Hope this has been useful to you! :)
0
 
LVL 3

Expert Comment

by:superslamwich
ID: 8170256
just a note, you can also use   {history.back()}   to go back
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 10131239
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: superslamwich {http:#8162442}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jAy
EE Cleanup Volunteer
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

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…
Suggested Courses

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