2

How can I hide the status bar and address bar through JavaScript? I have the following code:

 var params = 'width=400, height=400';
        params += ', top=0, left=0';
        params += ', directories=no';
        params += ', location=no';
        params += ', menubar=no';
        params += ', resizable=no';
        params += ', scrollbars=no';
        params += ', status=yes';
        params += ', toolbar=no';
        newwin = window.open('C:\Documents and Settings\Admin\Desktop\test.htm', 'windowname5', params);

In IE8 we can't hack using security option, so how can I achieve this?

mplungjan
  • 169,008
  • 28
  • 173
  • 236

2 Answers2

2
  • you are opening a local file. That is already a security issue
  • do not have spaces in the parameters,
  • more and more browsers block the removal of browser chrome. Live with it or pop a DIV with an embedded IFrame
  • no need to have parameters=no if you have at least one parameter - all that are allowed to be turned off are off by default when one of the parms are on
var params = 'width=400,height=400,top=0,left=0';

// you wanted to try to hide the status, then don't include it as =yes
    // params += ',status=yes'; 
    newwin = window.open('C:\Documents and Settings\Admin\Desktop\test.htm',
    'windowname5', params);

should do the same as your posted code except it would hide the status if allowed

mplungjan
  • 169,008
  • 28
  • 173
  • 236
2

To hide the status bar, change status=yes to status=no.

For security reasons, it's not possible to hide the address bar.

Guffa
  • 687,336
  • 108
  • 737
  • 1,005
  • @Ranjith: You can't do that. Many of the security settings is there just to prevent scripts from doing things that are generally considered bad, like hiding the address bar. – Guffa Apr 10 '12 at 14:59