Developer

Learn how to make chromed and dechromed windows

You can make chromed and dechromed window types with JavaScript. Here's how.

By Brent Lee Metcalfe

This is one of the most awesome windowing features available. But lamentably, it's Communicator-specific and requires a signed script. JavaScript 1.2 goes one better than 1.1 in removing browser toolbars; it can also remove all browser chrome—the title bar and three-dimensional borders.

To complicate matters slightly, because the script in this example is not signed, users must activate codebase principals to view the dechromed window.

For those who can't muster the energy to perform the above task, here are screen captures of the respective window types:

Chromed window:

Chromed window

Dechromed window:

Dechromed window

The code to create a chromeless window requests extended privileges from the user and adds a simple titlebar=no to the litany of features in the window open() method:

var bareWin = null;

var whoAmI = navigator.appName;

var whatAmI = parseInt(navigator.appVersion.charAt(0));

function stripTease() {
  if (whoAmI == "Netscape" && whatAmI >= 4) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");
  bareWin =
window.open('dechrome.html','unDress','titlebar=no,top=50,left=50,width=200,height=100');
  netscape.security.PrivilegeManager.disablePrivilege("UniversalBrowserWrite");
  }

    else {
      alert('Whoa, Web Builder!\nDownload a version of\nNetscape Communicator 4.x\nto view the chromeless window! ');
    }
}

Because the title bar and three-dimensional borders are gone, so is the accompanying functionality, such as the ability to drag the title bar, resize by dragging the chrome borders, and use the minimize, maximize, and close buttons.

Despite the browser-specific security hoops you have to jump through, this code lets you create a truly autonomous window. When I attended a 1997 conference for Windows Help writers, the burning issue was how to emulate the look and feel of a Windows Help pop-up window in HTML. Netscape's stealth marketing was hiding the answer all along.

Brent Lee Metcalfe is a Web architecture consultant.

Editor's Picks