title: Closing windows with Greasemonkey
body: <p>I've been writing a Greasemonkey script for Chrome (drags and drops as an extension) for use with Facebook.  I know that Greasemonkey is sandboxed and that, at least as far as Firefox goes, you cannot close windows with scripts unless you change a setting in the browser.  However, I know that most browsers allow child windows to be closed by the parent window without needing the confirmation of the user.  Anyways I'm trying to get my script to open a window, grab a text piece from an HTML object and close the window at the press of a button on the page.</p>
  
  <p>My code for opening the window looks like this: </p>
  
  <pre><code>function birthday(linkAddress) {
  var winNew=window.open(linkAddress, "_blank", "height=100", "width=100");
  /*code to be run on page*/
      winNew.close()
  }
  </code></pre>
  
  <p>The window opens fine but I get a javascript error in Chrome saying "cannot call method 'close' of undefined".  I assume there is something wrong with my object related to Greasemonkey sandboxing, but I'm at a loss to determine what.  Is it even possible to close a window using a Greasemonkey script in Chrome?  Is there some setting I need to enable?  Or is my code just wrong?  Keep in mind that this code is running from a function in the main window page that I set equal to a function in my script using an onClick event of a button I wrote to the page.  Also any tips for accessing DOM elements on the child page would be appreciated.</p>
  
  <p>Thanks for any help!</p>
  
  <p>(Sorry I'm quite new as well as out of practice with programming, and this is the first time I've written a Greasemonkey script)</p>