Tuesday, March 26, 2013

Re: Closing GWT application

It looks like 

public static native void closeWindow() /*-{    $wnd.closeWindow();  }-*/;
Should be:
public static native void closeWindow() /*-{    $doc.closeWindow();  }-*/;
And the JavaScript should be:

<script type="text/javascript" language="javascript">      document.closeWindow = function close() {          window.open('','_self',''); 
                window.close();  } </script>

On Monday, March 25, 2013 1:07:23 PM UTC-4, Michael Prentice wrote:
This answer has what you are looking for:

Specifically in Java:
myButton.addClickHandler(new ClickHandler(){          public void onClick(ClickEvent event) {              closeWindow();
}; });
public static native void closeWindow() /*-{    $wnd.closeWindow();  }-*/;
Then in JavaScript in your app's .html page:
<script type="text/javascript" language="javascript">      function closeWindow() {
                window.close();  } </script>
Someone please correct me if this isn't the proper way to call JavaScript from Java within GWT. I haven't tested this, but from the documentation and a lot of various questions/answers, this appears to be the way to do it. Especially when not using UIBinder and doing everything through GWT Designer and/or normal Java editors as Nalini needs.

On Tuesday, March 12, 2013 11:40:15 PM UTC-4, Michael Prentice wrote:
Here is how you do it on Chrome and IE:

<script type = "text/javascript"> 

   function closeWindow(){ 


There is more discussion here:

It explains that JavaScript can only close windows that were opened by JavaScript.

On Tuesday, March 12, 2013 5:44:03 PM UTC-4, nalin...@googlemail.com wrote:
I use JSNI code
public static native void closeBrowser()
to close my GWT app. It doesnt work with browsers other than IE....
Any suggestions?

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment