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 <weller@rami.io>

---------

Co-authored-by: luelista <weller@rami.io>
This commit is contained in:
Richard Schreiber
2026-05-19 17:07:54 +02:00
committed by GitHub
parent ce5af572cc
commit 9d7038b127

View File

@@ -53,8 +53,18 @@ function async_task_on_success(data) {
// hide waitingDialog when using browser's history back // hide waitingDialog when using browser's history back
waitingDialog.hide(); waitingDialog.hide();
}); });
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; location.href = data.redirect;
} }
}
$(this).trigger('pretix:async-task-success', data); $(this).trigger('pretix:async-task-success', data);
} }