title: javascript passing event from one window to another
body: <p>Is there any way to open a new window with,</p>
  
  <pre><code>var newWindow = window.open(...);
  </code></pre>
  
  <p>and then pass events from newWindow to its opener window? </p>
  
  <p>What I want to do is open a window that asks for some information, then once it's been entered close the new window and trigger an action in the original window. </p>
  
  <p>Thanks.</p>
  
  <p>edit: Thanks all. That's pretty much how I thought it worked, but I must be doing something stupid. Here's some test code I've been banging my head against a wall over:</p>
  
  <p>in parent.html</p>
  
  <pre><code>window.open("child.html");
  
  $(window).bind("something", function(e) {
      console.log('something happened');
  });
  </code></pre>
  
  <p>and in child.html</p>
  
  <pre><code>$("#somebutton").click(function() {
      $(window.opener).trigger("something");
      window.close();
  });
  </code></pre>
  
  <p>child opens fine, I click the button and child closes, but "something" never happens in parent!?</p>
  
  <p>I'd kind of like it to work the other way around too. Any way to make something like this work? </p>
  
  <pre><code>var child = window.open("child.html");
  
  $(child).bind("something", function() { ... });
  </code></pre>
  
  <p>Thanks.</p>