Look at

https://github.com/apache/wicket/blob/master/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/AjaxDownloadBehavior.java#L420

This cookie is added at server side

https://github.com/apache/wicket/blob/master/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/AjaxDownloadBehavior.java#L358

as part of the request serving the resource.

On Fri, Feb 14, 2025 at 3:25 AM Kent Tong <kent.tong...@gmail.com> wrote:

> Hi,
>
> In the AjaxDownloadBehavior, it seems to use the existence of a cookie with
> Max-Age=0 in the document to check if the download has been received
> successfully (in the new tab in an iframe). I haven't been able to figure
> out how this works. Any ideas?
>
> Thanks in advance!
>
>
> Wicket.AjaxDownload = {
> initiate : function(settings) {
> document.cookie = settings.name +
> '=;path=/;Max-Age=0;expires=Thu, 01 Jan 1970 00:00:01 GMT' +
> settings.sameSite;
> var notifyServer = function(result) {
> settings.attributes.ep = settings.attributes.ep || {};
> settings.attributes.ep.result = result;
> Wicket.Ajax.ajax(settings.attributes);
> };
>
> var checkComplete = function(watcher) {
> var result;
>
> if (document.cookie.indexOf(settings.name + '=') > -1) {
> result = "success";
> } else {
> var html = watcher.html();
> if (html && html.length) {
> result = "failed";
> }
> }
>


-- 
Regards - Ernesto Reinaldo Barreiro

Reply via email to