title: check if window is already open before it opens it
body: <p>I have gwt java code program that opens up a window with url. </p>
  
  <pre><code> Map&lt;String, Object&gt; ids = new HashMap&lt;String, Object&gt;();
                      ids.put("employeeId", UserToken.getCurrentUserToken().getEmployeeId());
                      createCaseUrl = ICMIntakeConstants.buildGrailsUrl(ICMIntakeConstants.CLIENT_APPLICATION_CONTROLLER, "", ids);
                      ICMWindow.open(createCaseUrl, "intake", "height=600,width=800,scrollbars=yes,resizable=yes,toolbar=no,directories=no,status=no,menubar=no", true);
  </code></pre>
  
  <p>The problem with the code it is being called twice for some reason (but IE and chrome handles it but not firefox), that is why the window pops up twice only in Firefox.I need to know how to prevent this. I was trying to modify the window's JSNI code but I have zero background and when I did research a simple alert would not come up so I couldn't really debug/see what is happening.</p>
  
  <pre><code>/**
   * Defines all variable in JavaScript accessible by Java code and opens a new browser window
   * with the specified url, name and features.
   */
  public static native void open(String url, String name, String features, boolean force) 
  /*-{
    $wnd.alert("test2");
      var winRef;
      try {
  
          if (force)
          {
  
  
                   winRef = $wnd.open(url,name, features);
  
                    $wnd.alert("test1 force");
                    Alert.alert("clicked!");
  
          }
          else
          {
              $wnd.alert("test2");
               winRef = $wnd.open("",name, features);
               if(winRef.location == 'about:blank')
               {
                    winRef.location=url
               }
               else 
               {
                    if(!/Chrome[\/\s]/.test(navigator.userAgent))
                    {
                        winRef.alert("Please click Ok To Continue....");
                    }
               }
          }
  
          // Set focus to the opened window
          winRef.focus();
  
      } catch (err) {
      }         
  }-*/;
  </code></pre>
  
  <p>I tried calling the open() method through JUNIT test but nothing...</p>
  
  <p>Can anyone tell me how can I make the alert pop up coz the above code won't work even if I erased the whole code and just left the  $wnd.alert("test2");? and how can I check if winref exists in JSNI then I shall not open the window? Pls help.</p>
  
  <p>Or is there a way I can insert a like a javascript code in the window being opened? What is the best way to resolve this?
  thanks</p>