mirror of
https://github.com/pretix/pretix.git
synced 2026-05-19 17:34:03 +00:00
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:
committed by
GitHub
parent
ce5af572cc
commit
9d7038b127
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user