spacer

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

home / experts / javascript / column7


Window Attributes

Developer News
Microsoft Shows Some Ankle With Visual Studio
Gentoo Linux Cancels Distribution
It's Official: Windows 7 at PDC, WinHEC

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
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
Avaya Article: Call Control XML - Powerful, Standards-Based Call Control
Internet.com eBook: The Pros and Cons of Outsourcing
Go Parallel Article: Scalable Parallelism with Intel(R) Threading Building Blocks
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
Go Parallel Article: James Reinders on the Intel Parallel Studio Beta Program
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Go Parallel Article: Getting Started with TBB on Windows
HP eBook: Storage Networking , Part 1
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Go Parallel Video: Intel(R) Threading Building Blocks: A New Method for Threading in C++
HP Video: Is Your Data Center Ready for a Real World Disaster?
Microsoft Partner Portal Video: Microsoft Gold Certified Partners Build Successful Practices
HP On Demand Webcast: Virtualization in Action
Go Parallel Video: Performance and Threading Tools for Game Developers
Rackspace Hosting Center: Customer Videos
Intel vPro Developer Virtual Bootcamp
HP Disaster-Proof Solutions eSeminar
HP On Demand Webcast: Discover the Benefits of Virtualization
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Microsoft Download: Silverlight 2 Software Development Kit Beta 2
30-Day Trial: SPAMfighter Exchange Module
Red Gate Download: SQL Toolbelt
Iron Speed Designer Application Generator
Microsoft Download: Silverlight 2 Beta 2 Runtime
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
IBM IT Innovation Article: Green Servers Provide a Competitive Advantage
Microsoft Article: Expression Web 2 for PHP Developers--Simplify Your PHP Applications
Featured Algorithm: Intel Threading Building Blocks - parallel_reduce
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES
webref The latest from WebReference.com Browse >
Controllers: Programming Application Logic - Part 2 · How to Use JavaScript to Validate Form Data · Controllers: Programming Application Logic
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Sprint Launches Mobile WiMAX Network · Albatron Downsizes with the KI780G Mini-ITX Motherboard · Can't Find a Wi-Fi Network? Make Your Own.

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