home / experts / javascript / column7 |
|
As you know from the previous section, you can refer to the new window's
You can also load a new document in the remote window, by assigning an URL to the
But what happens if the user closed the new window? The browser would generate an error, because the object no longer exists. Therefore, you should check if the remote window still exists. The following statement closes the remote window if it still exists:
If you're using a method that isn't supported by all JavaScript-enabled browsers, you should check if the new window exists, and then if the method exists. There are two ways to do this. The first one relies on short-circuit evaluation, whereas the second one doesn't. Take a look at the following example (using both methods):
|
Created: November 18, 1997
Revised: December 4, 1997
URL: http://www.webreference.com/js/column7/manipulate.html