• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Working with New Windows

In the next chapter on window object methods and events, we’ll cover one of the most popular ways of working with window objects—opening new browser windows with the window.open method. Two properties in this chapter are useful when working with new windows you’ve opened up—closed and opener. The closed property enables you to determine whether a window has been closed, and the opener property holds the window that opened the current window (the parent window).

Here’s an example that puts these properties to work. In this case, I’ll let the user open and close a new window using buttons. The open button will open a new window, and I’ll use the closed property of the new window to check whether it’s already been closed when the user clicks the close button in the main window—if the window is already closed, there’s no reason to close it again.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint