JavaScript Windows
The final decision on how pages are opened is made by your visitors. All you can do in your web page is to suggest how you think your visitors should open the new page. Provided that your visotr hasn't changed their browser settings to override your suggestion the page should open as you suggest.
There are two ways to suggest to the browser that the new page should not default to being opened in the current window.
One of these ways is to use the HTML 3.2 attribute target when you define the link to the new page. That attribute could be used to specify that the link should open in a new window (by giving it a value of "_blank") or open in an existing window elsewhere (by specifying the name of the window). As allowing your visitor to choose where they open new pages is considered to be more accessible and user friendly this attribute was not included in the HTML 4 standard although browsers still support it as it will still be quite a while before al of the web is updated to use HTML 4. Apart from having been removed from the standards, the other disadvantage to using target is that there is no way to tell the browser where to open the new window or how big to make it. There is also no way to distinguish between new windows and new tabs in the existing window.
The other way of requesting for the browser to open a new window and the only way that is still a part of the standards is the JavaScript window.open command.This command takes up to four parameters that allow you to at least make some suggestions regarding the appearance of the new window.
The first two of the parameters are the ones that correspond to a regular link with the first parameter containing the address of the page (which would normally appear in the href attribute) and the second containing the name of the window you want to open it in (as would go in the target attribute).
The third parameter of the JavaScript window.open is the one that allows you to make suggestions as to how the new window should look. It probides you with the ability to specify the position for the top left corner of the new window on the screen, the width and height of the new window, and even whether menu bars, toolbars, and status bars should be included. Not all browsers will follow these suggestions since most plave minimums on new window sizes so that if you specify a window too small your suggestion will be ignored. Many also restrict which bars you can hide in a window so as to help ensure that your visitor's security isn't compromised by their not being able to see such information as the address of the current page and any error messages in the status bar.
You still have no control whatever as to whether JavaScript will open the new page in a new window or a new tab. That is entirely under the control of your visitor and if they choose to have new tabs created instead of new windows then the entire third parameter will be ignored as the existing browser settings will be used. Most browsers also give their owner the ability to decide for themselves which of the opions that can be specified in the third parameter that they will process. If your visitor wants their browser to decide how big new windows should be rather than individual web pages then the width and height specified in the window.open will be ignored.
Overall, what yuo can achieve by using the JavaScript window.open command now is far less than was originally intended. This is due in part to security issues and the need to ensure that people can always see certain information relating to the web page they are visiting. Another reason why it is not as useful as it used to be is that browsers now support tabs as well as windows and the JavaScript window.open command was never updated to allow this particular distinction to be made. One fo the reasons why this update wasn't made is that people's thinking as to what makes for the most user friendly experience had changed in the late 1990s when it was realised that it is far better to allow your visitors to control where web pages open rather than trying to force them to open a particular way. It is no longer possible to force your visitors to view pages the way you want as modern browsers provide them with options that allow them to override almost everything in the web page except for the content itself.
Where you can call a JavaScript window.open has also changed with browsers now including popup blockers that prevent the command from running if it wasn't called as a response to an action of your visitor. Sites can therefore no longer create extra windows automatically as the person enters the site.
My JavaScript popup Window series of tutorials was written a while ago before some of these limitations were applied and so you may find that not all browsers will allow you to do everything that the tutorial series suggests is possible.
Alternatives to window.open have been developed that provide far greater contol by not opening a new window or tab but rather displaying te content in front of the existing page. My Modal Dialog Box and Modal Image Box demonstrate how you can do ths and also make the new "window" modal so that your visitor must respond to the content of the new "window" before being able to return to the page they were on before.
There are two ways to suggest to the browser that the new page should not default to being opened in the current window.
One of these ways is to use the HTML 3.2 attribute target when you define the link to the new page. That attribute could be used to specify that the link should open in a new window (by giving it a value of "_blank") or open in an existing window elsewhere (by specifying the name of the window). As allowing your visitor to choose where they open new pages is considered to be more accessible and user friendly this attribute was not included in the HTML 4 standard although browsers still support it as it will still be quite a while before al of the web is updated to use HTML 4. Apart from having been removed from the standards, the other disadvantage to using target is that there is no way to tell the browser where to open the new window or how big to make it. There is also no way to distinguish between new windows and new tabs in the existing window.
The other way of requesting for the browser to open a new window and the only way that is still a part of the standards is the JavaScript window.open command.This command takes up to four parameters that allow you to at least make some suggestions regarding the appearance of the new window.
The first two of the parameters are the ones that correspond to a regular link with the first parameter containing the address of the page (which would normally appear in the href attribute) and the second containing the name of the window you want to open it in (as would go in the target attribute).
The third parameter of the JavaScript window.open is the one that allows you to make suggestions as to how the new window should look. It probides you with the ability to specify the position for the top left corner of the new window on the screen, the width and height of the new window, and even whether menu bars, toolbars, and status bars should be included. Not all browsers will follow these suggestions since most plave minimums on new window sizes so that if you specify a window too small your suggestion will be ignored. Many also restrict which bars you can hide in a window so as to help ensure that your visitor's security isn't compromised by their not being able to see such information as the address of the current page and any error messages in the status bar.
You still have no control whatever as to whether JavaScript will open the new page in a new window or a new tab. That is entirely under the control of your visitor and if they choose to have new tabs created instead of new windows then the entire third parameter will be ignored as the existing browser settings will be used. Most browsers also give their owner the ability to decide for themselves which of the opions that can be specified in the third parameter that they will process. If your visitor wants their browser to decide how big new windows should be rather than individual web pages then the width and height specified in the window.open will be ignored.
Overall, what yuo can achieve by using the JavaScript window.open command now is far less than was originally intended. This is due in part to security issues and the need to ensure that people can always see certain information relating to the web page they are visiting. Another reason why it is not as useful as it used to be is that browsers now support tabs as well as windows and the JavaScript window.open command was never updated to allow this particular distinction to be made. One fo the reasons why this update wasn't made is that people's thinking as to what makes for the most user friendly experience had changed in the late 1990s when it was realised that it is far better to allow your visitors to control where web pages open rather than trying to force them to open a particular way. It is no longer possible to force your visitors to view pages the way you want as modern browsers provide them with options that allow them to override almost everything in the web page except for the content itself.
Where you can call a JavaScript window.open has also changed with browsers now including popup blockers that prevent the command from running if it wasn't called as a response to an action of your visitor. Sites can therefore no longer create extra windows automatically as the person enters the site.
My JavaScript popup Window series of tutorials was written a while ago before some of these limitations were applied and so you may find that not all browsers will allow you to do everything that the tutorial series suggests is possible.
Alternatives to window.open have been developed that provide far greater contol by not opening a new window or tab but rather displaying te content in front of the existing page. My Modal Dialog Box and Modal Image Box demonstrate how you can do ths and also make the new "window" modal so that your visitor must respond to the content of the new "window" before being able to return to the page they were on before.
Source...