Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    GWT Window.open

    I a link to download a file. I am using Window.open(url)... to implement this. However, I want to be able to handle the close event of the window. I am not able to get to the actual window handler? Is there a way I can do this?

    Thanks,

    #2
    No, there's no real way to get notification of a file download completing within the browser. The only reliable approach is to have server code involved in the download which notices when the file is done streaming.

    Comment


      #3
      From the client how would I do this. I don't want to stream the file to the server. I need to have it stream to the client's computer. I guess what I am saying is can you explain further or give me some example?

      Thanks,

      Comment


        #4
        You need to write a servlet that takes over the function of downloading files (like a webserver would). Then this servlet should set a server side flag when the filedownload completes (for example in the HttpSession) and client-side code can poll to see when this flag is set.

        This is non-trivial to implement, and unless you feel confident you can tackle it from the above description, you should probably rearrange your UI so that you don't need to know when download completes. That's what substantially all sites and applications that allow downloading do.

        Comment


          #5
          I don't think I will take on this task. However, maybe you should add this as an enhancement. I know you have the upload and the grid the JSObject download.

          However, back to my original question about the Window.open. I just need to get a handle on the Window so I can handle the onCloseEvent. However, this is a static window and Window.open() does not return anything. Will the com.smartgwt.client.widgets.Window handle this for me? Just a shot.

          Comment


            #6
            Window.open() produces a new browser Window. If the URL is a GWT application, that application can register for the events Window provides if you need to listen for unload or similar events.

            com.smartgwt.client.widgets.Window is an HTML UI component that runs in the current browser window. Opening one will not initiate file download, but it supports a variety of events.

            Comment

            Working...
            X