FileTransfer / openInDownload problem on IE7

View: New views
3 Messages — Rating Filter:   Alert me  

FileTransfer / openInDownload problem on IE7

by Michael Benz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
I've ran into a small problem with 'dwr.engine.openInDownload' on IE.
In my (rather large) webapp there are download links users can click to
download files, which are dynamically generated on the server (depending
on certain input fields). The download process works fine on Firefox. On
IE however, the user first gets the standard security warning that a
file download has been blocked. Now the problem is, that when the user
tries to download the file anyway (click on security warning and select
'download...') the whole page gets reloaded. This is quite bad in my
case since, I don't track the current state and all client data is lost.
Is there any way to prevent this from happening? Or am i just doing it
wrong? :)


Here's the javascript code I'm using:

function saveFile() {
    // query is extracted from an input field here
    var query = "...";
    QueryService.generateCSVFile(query, {
        callback: function(data) {
            dwr.engine.openInDownload(data);
        },
        errorHandler: function(errMsg, err) {
            displayErrorMessage(err);
        }
    });
}

On the Java side it looks like this:

String someString = "....";
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
buffer.write(someString.getBytes());
return new FileTransfer("values.csv", "text/comma-separated-values",
buffer.toByteArray());


I've also tried using 'window.open' or an iframe to initiate the
download but couldn't get it to work (IE Popup blocker basically leads
to the same problem).

Thanks in advance for your help,
Michael




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: FileTransfer / openInDownload problem on IE7

by Joe Walker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I've done 2 things:
- Added a parameter to the InMemoryDownloadManager (the default) to allow you to tweak the number of downloads before purge. The default is 1, but if you set the DWR init-param downloadRequestsBeforeRemove to something else, you can change the default.
- If you are using the FileStoreDownloadManager, then I've turned off auto-delete altogether.

These tweaks should hit SVN soon.

I guess the ideal solution would be to detect *completed* downloads rather than started ones. If anyone feels like having a play ...

Joe.

On Mon, Sep 22, 2008 at 11:13 AM, Michael Benz <michael.benz@...> wrote:
Hi,
I've ran into a small problem with 'dwr.engine.openInDownload' on IE.
In my (rather large) webapp there are download links users can click to download files, which are dynamically generated on the server (depending on certain input fields). The download process works fine on Firefox. On IE however, the user first gets the standard security warning that a file download has been blocked. Now the problem is, that when the user tries to download the file anyway (click on security warning and select 'download...') the whole page gets reloaded. This is quite bad in my case since, I don't track the current state and all client data is lost. Is there any way to prevent this from happening? Or am i just doing it wrong? :)


Here's the javascript code I'm using:

function saveFile() {
  // query is extracted from an input field here
  var query = "...";
  QueryService.generateCSVFile(query, {
      callback: function(data) {
          dwr.engine.openInDownload(data);
      },
      errorHandler: function(errMsg, err) {
          displayErrorMessage(err);
      }
  });
}

On the Java side it looks like this:

String someString = "....";
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
buffer.write(someString.getBytes());
return new FileTransfer("values.csv", "text/comma-separated-values", buffer.toByteArray());


I've also tried using 'window.open' or an iframe to initiate the download but couldn't get it to work (IE Popup blocker basically leads to the same problem).

Thanks in advance for your help,
Michael




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



Re: FileTransfer / openInDownload problem on IE7

by prasadkamath :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Prasad Kamath wrote:
Hi Micheal,
              I got to see your post regarding the problem with the Internet explorer blocking the file download triggered by the dwr method and the page getting reloaded if you try to continue.Actually even I have run into a similar issue.It would be great if you can let me know whether you were able to get around this problem.Even I tried the iframe and window.open strategies ,but as mentioned by you,even these don't work.

Cheers,
Prasad

Hi,
I've ran into a small problem with 'dwr.engine.openInDownload' on IE.
In my (rather large) webapp there are download links users can click to
download files, which are dynamically generated on the server (depending
on certain input fields). The download process works fine on Firefox. On
IE however, the user first gets the standard security warning that a
file download has been blocked. Now the problem is, that when the user
tries to download the file anyway (click on security warning and select
'download...') the whole page gets reloaded. This is quite bad in my
case since, I don't track the current state and all client data is lost.
Is there any way to prevent this from happening? Or am i just doing it
wrong? :)


Here's the javascript code I'm using:

function saveFile() {
    // query is extracted from an input field here
    var query = "...";
    QueryService.generateCSVFile(query, {
        callback: function(data) {
            dwr.engine.openInDownload(data);
        },
        errorHandler: function(errMsg, err) {
            displayErrorMessage(err);
        }
    });
}

On the Java side it looks like this:

String someString = "....";
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
buffer.write(someString.getBytes());
return new FileTransfer("values.csv", "text/comma-separated-values",
buffer.toByteArray());


I've also tried using 'window.open' or an iframe to initiate the
download but couldn't get it to work (IE Popup blocker basically leads
to the same problem).

Thanks in advance for your help,
Michael




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
For additional commands, e-mail: users-help@dwr.dev.java.net