Confirming a download

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Confirming a download

Michel Bany
I am trying to download some dynamically built file from Seaside with user confirmation.
The code looks like this:

html anchor
callback: [

(self confirm: 'This is a huge download, proceed?')
ifTrue: [self session returnResponse: (WAResponse new contentType: 'text/plain';
headerAt: 'Expires' put: 'Thu, 01 Jan 1900 12:00:00 GMT';
attachmentWithFileName: 'foo.txt';
nextPutAll: 'bar';
yourself)]

]; with: 'Download'.

That works fine, except that the dialog remains in the browser when the user confirms the download.
I could not find any way to automatically remove the dialog and return to the previous screen.
Is there another way to achieve what I want?

Michel.

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Confirming a download

Michael Lucas-Smith-3
Michel Bany wrote:

> *I am trying to download some dynamically built file from Seaside with
> user confirmation.*
> *The code looks like this:*
> *
> *
> * html* anchor
> callback: [
>
> (self confirm: 'This is a huge download, proceed?')
> ifTrue: [self session returnResponse: (WAResponse new contentType:
> 'text/plain';
> headerAt: 'Expires' put: 'Thu, 01 Jan 1900 12:00:00 GMT';
> attachmentWithFileName: 'foo.txt';
> nextPutAll: 'bar';
> yourself)]
>
> ]; with: 'Download'.
>
> That works fine, except that the dialog remains in the browser when
> the user confirms the download.
> I could not find any way to automatically remove the dialog and return
> to the previous screen.
> Is there another way to achieve what I want?
Probably the easiest thing to do would be to make the confirm branch
send some javascript to the client for it to then go to the resource to
download. That way the confirm will complete, it'll go back to the
previous page, then fetch the resource to download.

Another approach would be to add a hidden iframe which has a url of the
resource as the confirm true branch.

Cheers,
Michael
>
> Michel.
> ------------------------------------------------------------------------
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>  

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside