spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column7


Window Attributes

Developer News
MicrosoftÂ’s Automated Agent: Can We Talk?
Borland Finally Sells CodeGear
Red Hat Heads For The JON 2.0

As you may recall, the third parameter of the window.open() method is a comma-separated list specifying window ornaments to display. The supported features are:

alwaysLowered=[yes|no|1|0] (Navigator 4.0 only)
Specifies whether to create a new window that floats below other windows, whether it is active or not. This is a secure feature and must be set in signed scripts.
alwaysRaised=[yes|no|1|0] (Navigator 4.0 only)
Specifies whether to create a new window that floats on top of other windows, whether it is active or not. This is a secure feature and must be set in signed scripts.
channelmode=[yes|no|1|0] (Internet Explorer 4.0 only)
Specifies whether to display the window in theater mode and show the channel band.
dependent=[yes|no|1|0] (Navigator 4.0 only)
Specifies whether to create a new window as a child of the current window. A dependent window closes when its parent window closes. On Windows platforms, a dependent window does not show on the task bar. It also has a narrow title bar, and a smaller "x" button to close the dependent window.
directories=[yes|no|1|0]
Specifies whether to create the standard browser directory buttons. In some browsers the directory buttons can be customized by the user.
fullscreen=[yes|no|1|0] (Internet Explorer 4.0 only)
Specifies whether to display the browser in a full-screen or normal window. Use Alt+F4 to close the window.
height=number
Specifies the height of the window in pixels. The minimum value should be 100.
hotkeys=[yes|no|1|0] (Navigator 4.0 only)
Specifies whether to enable most hotkeys in a new window that has no menu bar. The security and quit hotkeys remain enabled in any case.
innerHeight=number (Navigator 4.0 only)
Specifies the height, in pixels, of the window's content area. A signed script is required to create a window smaller than 100 x 100 pixels. This feature replaces height, which remains for backwards compatibility.
innerWidth=number (Navigator 4.0 only)
Specifies the width, in pixels, of the window's content area. A signed script is required to create a window smaller than 100 x 100 pixels. This feature replaces width, which remains for backwards compatibility.
location=[yes|no|1|0]
Specifies whether to display the Location field, the input field for entering URLs directly into the browser.
menubar=[yes|no|1|0]
Specifies whether to create the menu at the top of the window. In Internet Explorer, this feature is yes by default. A menu normally consists of a "File" option, an "Edit" option, and other browser-specific options.
outerHeight=number (Navigator 4.0 only)
Specifies the vertical dimension, in pixels, of the outside boundary of the window. A signed script is required to create a window smaller than 100 x 100 pixels.
outerWidth=number (Navigator 4.0 only)
Specifies the horizontal dimension, in pixels, of the outside boundary of the window. A signed script is required to create a window smaller than 100 x 100 pixels.
resizable=[yes|no|1|0]
Specifies whether to display resize handles at the corners of the window, which enable the user to resize the window. If this feature is not turned on explicitly, the user cannot resize the new window.
screenX=number (Navigator 4.0) left=number (Internet Explorer 4.0)
Specifies the distance the new window is placed from the left side of the screen. In Navigator, to place a window offscreen, set this feature in a signed scripts.
screenY=number (Navigator 4.0) top=number (Internet Explorer 4.0)
Specifies the distance the new window is placed from the top of the screen. In Navigator, to place a window offscreen, set this feature in a signed scripts.
scrollbars=[yes|no|1|0]
Specifies whether to display horizontal and vertical scroll bars, when the content exceeds the dimensions of the window. This feature is yes by default.
status=[yes|no|1|0]
Specifies whether to create a status bar at the bottom of the window. In Internet Explorer, this feature is yes by default.
titlebar=[yes|no|1|0] (Navigator 4.0 only)
Specifies whether to create a window with a title bar at the top. This feature is yes by default, but can be set to no in a signed script.
toolbar=[yes|no|1|0]
Specifies whether to display the browser toolbar, with buttons such as Back and Forward.
z-lock=[yes|no|1|0] (Navigator 4.0 only)
Specifies whether to create a new window that does not rise above other windows when activated. This is a secure feature and must be set in signed scripts.
width=number
Specifies the width of the window in pixels. The minimum value should be 100.

Many of these features can be either yes or no, 1 or 0. Alternatively, if you want to turn a feature on, you can simply specify the feature name in the comma-separated list.

How the alwaysLowered, alwaysRaised, and z-lock features behave depends on the windowing hierarchy of the platform. For example, on Windows, an alwaysLowered or z-locked browser window is below all windows in all open applications. On Macintosh, an alwaysLowered browser window is below all browser windows, but not necessarily below windows in other open applications. Similarly for an alwaysRaised window.

For compatibility reasons, you should always specify each feature explicity. Use the following interactive form to construct a script segment that launches a window with specified features:

channelmode dependent
directories fullscreen
location menubar
resizable scrollbars
status toolbar
height width
innerHeight innerWidth
outerHeight outerWidth
screenX and left screenY and top
newURL newName
orgName varName

In case your browser doesn't support JavaScript, here's an example of the required script:

<SCRIPT LANGUAGE="JavaScript">
<!--

// Copyright (c) 2000 internet.com Corp.
// http://www.webreference.com/js/
// License is granted if and only if this entire
// copyright notice is included. By Tomer Shiran.

function launch(newURL, newName, newFeatures, orgName) {
  var remote = open(newURL, newName, newFeatures);
  if (remote.opener == null)
    remote.opener = window;
  remote.opener.name = orgName;
  return remote;
}

function launchRemote() {
  myRemote = launch("http://www.webreference.com/js/column7/demo.html",
                    "myRemote",
                    "height=350,width=110,alwaysLowered=0,alwaysRaised=0,
                       channelmode=0,dependent=0,directories=0,fullscreen=0,
                       hotkeys=1,location=0,menubar=0,resizable=0,scrollbars=0,
                       status=0,titlebar=1,toolbar=0,z-lock=0",
                    "myWindow");
}

// -->
</SCRIPT>

Note that this form does not check if your input is valid. Thus, you should read the description of each feature. Also note that there are too many variations to cover, so you should test your script on several browsers. For example, some features override others, but only in some browsers, so it would be impossible to cover all of the possibilities. Simply try it out and see if it does what you want. If you want to be on the safe side, do not use features that are not supported by all browsers and versions.

Another important point is that features that require a signed script should not be used in a regular one. Some browsers, such as the Mac version of Netscape Navigator 4.0x, generate a JavaScript error when that is done. The problematic features are:

alwaysLowered=1|yes
alwaysRaised=1|yes
hotkeys=0|no
titlebar=0|no
z-lock=1|yes

After generating the code with the preceding form, copy and paste it in the <HEAD>...</HEAD> portion of your document. Then invoke the function with an event handler, a button, or a link (text or image):

<BODY onLoad="launchRemote()">

<FORM>
<INPUT TYPE="button" VALUE="launch" onClick="launchRemote()">
</FORM>

<A HREF="javascript:launchRemote()">...</A>

http://www.internet.com



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: HyperV-The Killer Feature in WinServer ‘08
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Win Server ‘08
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Intel Featured Algorhythm: Intel Threading Building Blocks--The Pipeline Class
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES
webref The latest from WebReference.com Browse >
Software Engineering for Ajax · Perl Pragma Primer · Implement Drag and Drop in Your Web Apps: Part 2
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-FiPlanet Gift Guide, Class of 2008 · Patriot Updates their DDR2 4GB PC2-8500 Line to "Revision 2" · Review: Samsung SCX-4500 Multifunction Printer

Created: November 18, 1997
Revised: December 4, 1997
URL: http://www.webreference.com/js/column7/attributes.html