From 9d7038b127046e0f20eb788e9cbfde8ea722c8f8 Mon Sep 17 00:00:00 2001 From: Richard Schreiber Date: Tue, 19 May 2026 17:07:54 +0200 Subject: [PATCH] Force async_task_is_download to be downloaded if in iframe (Z#23234427) (#6194) * Force async_task_is_download to be downloaded if in iframe (Z#23234427) * Update src/pretix/static/pretixbase/js/asynctask.js Co-authored-by: luelista --------- Co-authored-by: luelista --- src/pretix/static/pretixbase/js/asynctask.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/pretix/static/pretixbase/js/asynctask.js b/src/pretix/static/pretixbase/js/asynctask.js index b8924ecd0a..a2833c9949 100644 --- a/src/pretix/static/pretixbase/js/asynctask.js +++ b/src/pretix/static/pretixbase/js/asynctask.js @@ -53,7 +53,17 @@ function async_task_on_success(data) { // hide waitingDialog when using browser's history back waitingDialog.hide(); }); - location.href = data.redirect; + if (async_task_is_download && window.self !== window.top) { + // if in an iframe, force to download an async_task_is_download + // e.g. pretix-reseller embeds order-page in iframe, which would cause ticket-PDFs to be displayed inline + var a = document.createElement("a"); + a.href = data.redirect; + a.download = ""; + a.target = "_blank"; + a.click(); + } else { + location.href = data.redirect; + } } $(this).trigger('pretix:async-task-success', data); }