views:

1939

answers:

6

Is there some way to hide the browser toolbar / statusbar etc in current window via javascript? I know I can do it in a popup with window.open () but i need to do it this way. Is it possible at all?

+3  A: 

I believe this is not possible. And anyway, just don't do it. Your page can do what it wants with the rendering area, but the rest of the browser belongs to the user and websites have no business messing with it.

Marijn
A: 

No. This would be a massive security hole if it were possible... not to mention annoying.

My browser wont even let you do this in popups... which can be annoying aswell!

Mez
A: 

Marijn: ok thanks. This is for an intranet site and we display InfoPath forms as separate, no-toolbar, no-statusbar windows. This is a client requirement, I'm not trying to do evil ;)

axel_c
If you're only targeting one browser and possibly even have control over the machines, there's probably some plug-in to do this.
Marijn
OK, will look into that, thanks
axel_c
+1  A: 

As per the previous answer, this isn't possible to my knowledge and is best avoided anyway. Even if a solution can be found, bear in mind that most browsers these days allow the user to prevent Javascript from interfering with their browser settings and window chrome, even when using window.open. So you've got absolutely no way of guarenteeing the behaviour that you're looking for and consequently you're best off forgetting about it altogether. Let the user decide how they want their window configured.

Luke Bennett
A: 

To Martin Meredith, Luke, Marijn: thanks for your quick reply. It is now settled that it's not possible.

I agree with you all about this being an undesirable behavior, but as i stated before, this is for a bank intranet application where all users are running a tightly controlled, centrally-configured, customized and hacked to death browser they have no control over anyway, and the client actually wants this behavior for the application. It would be dumb and annoying to do this in a public facing/general website, of course. But sometimes we just have to get the job done :(

axel_c
Life would be so much simpler without clients!
Luke Bennett
A: 

You may want to investigate using an HTA (HTML Application).

It will render HTML pages with zero browser chrome, a custom icon can be shown on the task bar, and the entire "caption" can be removed. The last option yields a floating window without eve a close button.

For how I imagine your needs to be, you would want to start with something like:

<html>
  <head>
    <title>HTA Demonstration</title>
    <hta:application innerborder="no" icon="magnify.exe" />
  </head>
  <body style="overflow: hidden; margin: 0;">
    <iframe src="http://www.yahoo.com" style="width: 100%; height: 100%;"></iframe>
  </body>
</html>

Save the above HTML into a file and give it "example.hta" as the file name. You'll then have a generic icon on your desktop which you can double click on to start.

<hta:application innerborder="no" caption="no" icon="magnify.exe" />

This change will remove the title bar when running the script. Press Alt-F4 to exit the script if you do this.

This will also only work with IE, however that should not be an issue on an intranet.

Zorantula
Will look into this stuff, thanks
axel_c