Rather than the web page owner deciding what should be opened in a new window, it is now considered to be better manners to leave that choice to your visitors. There are a few rare situations though where you really do need to open a new window from your page in order for your application to function correctly (not many though since most are now better handled within the web page itself).
When you absolutely must open a new window you is the window.open() method which takes up to four parameters. The first of these parameters specifies the page to be opened in the new window (it can be left blank if generating the content of the window from the following JavaScript but all such situations are better handled within the current page).
The second parameter is the name of the window to open. Most people incorrectly use '_blank' for this so as to force a new window to open every time this function is called. A better option is to actually give your new window a proper name and to reuse that window for all of the window.open calls within your page (or even your entire site). Your visitor's will seldom still need the content of the first extra window when they run the code that opens a second and so reusing the existing new window is much friendlier.
The third parameter contains suggestions on how big the new window should be, where it will be placed on the screen, and what toolbars it should include. These are only suggestions and as well as your visitor being able to override some of them (by setting their browser to always open new windows at the same size in the same place), modern browsers also ignore requests to omit certain of the toolbars which are considered essential for maintaining browser security. In other words you have no control over how the new window will look and so you will be far better off if you need that level of control to work out a way to do what you need within the current web page.
The fourth parameter is only used when the window named in the second parameter is already open. It contains a boolean value to tell that window whether the new page should be added to the history as a new entry or should overwrite the previously displayed page in the history. This will affect whether your visitors can use their back button in the new window you opened.
This example shows a function that will open a new window containing the page passed to the function. Each time the function is called the same window will be reused and the new page will replace the prior page in history.
newwin = function(page) {
window.open(page,'javascriptabout',,true);
}
