Javascript method for opening a browser window.

Syntax:
someNewWin = window.open( url, name, options )

  • url should be obvious
  • name allows you to name the window, and also to determine the destination of the new window. It works like the 'target' attribute of <a>. For instance, a value of '_top' means that the new content will fill the current browser context and gets rid of any frames in the process (yay! frames suck!). _blank creates a new window. There's a section about link targetting in general in an article at http://www.macam98.ac.il/javascripts/nw-07-javascript.html#target
  • options allow you to specify the nature of your new window. The options you give should be in a form something like 'op_scroll=0,resizable=1,status=0'. There are a whole stack of options including some to allow you to have a non-resizable window and to set its height and width.

I can't find an ecmsa document to check the standard against - plenty of broken links but nothing substantial in the way of html. There are pdf documents of the most recent version available on the site at the time of writing (335, December 2001) at http://www.ecma.ch/ecma1/STAND/ecma-335.htm. If anybody has anything better, please /msg me. Here's a document with a bit more information, but it's ie specific, so be wary.
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp

And here's an example:
var winflags = "width=5,height=5,toolbar=0,location=0,"; winflags = winflags+"directories=0,menubar=0,scrollbars=0,"; winflags = winflags+"op_scroll=0,resizable=1,status=0";

window.open('index.html','_top', winflags);

Log in or register to write something here or to contact authors.