From 7cc5179e85da27765a29337f69f356d70baed651 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Tue, 1 Sep 2020 15:46:31 +0200 Subject: [PATCH] Fix #1040 -- Work around firefox bug in widget --- .../static/pretixpresale/js/widget/widget.js | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/pretix/static/pretixpresale/js/widget/widget.js b/src/pretix/static/pretixpresale/js/widget/widget.js index 399f67bee..d96d72cda 100644 --- a/src/pretix/static/pretixpresale/js/widget/widget.js +++ b/src/pretix/static/pretixpresale/js/widget/widget.js @@ -509,7 +509,7 @@ var shared_methods = { this.resume(); } } else { - var url = this.$root.formTarget + "&locale=" + lang + "&ajax=1"; + var url = this.$root.formAction + "&locale=" + lang + "&ajax=1"; this.$root.overlay.frame_loading = true; this.async_task_interval = 100; @@ -734,7 +734,7 @@ Vue.component('pretix-widget-event-form', { + '
' + '{{ $root.date_range }}' + '
' - + '
' + + '' + '' + '' + '' @@ -1241,7 +1241,7 @@ Vue.component('pretix-widget', { Vue.component('pretix-button', { template: ('
' + '
' - + '' + + '' + '' + '' + '' @@ -1416,6 +1416,19 @@ var shared_root_computed = { cookieName: function () { return "pretix_widget_" + this.target_url.replace(/[^a-zA-Z0-9]+/g, "_"); }, + formTarget: function () { + var is_firefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1; + var is_android = true || navigator.platform.toLowerCase().indexOf("android") > -1; + if (is_android && is_firefox) { + // Opening a POST form in a new browser fails in Firefox. This is supposed to be fixed since FF 76 + // but for some reason, it is still the case in FF for Android. + // https://bugzilla.mozilla.org/show_bug.cgi?id=1629441 + // https://github.com/pretix/pretix/issues/1040 + return "_top"; + } else { + return "_blank"; + } + }, voucherFormTarget: function () { var form_target = this.target_url + 'w/' + widget_id + '/redeem?iframe=1&locale=' + lang; var cookie = getCookie(this.cookieName); @@ -1433,7 +1446,7 @@ var shared_root_computed = { } return 'post'; }, - formTarget: function () { + formAction: function () { if (!this.useIframe && this.is_button && this.items.length === 0) { var target = this.target_url; if (this.voucher_code) {