|
@@ -146,10 +146,12 @@ function upload(form,data) {
|
|
|
|
|
|
classmod(form, [['ok',ok],['err',!ok],['running',0],['done',1]]);
|
|
|
|
|
|
- // Automatically reload the page after successful upload
|
|
|
- const rf = parseInt(xhr.getResponseHeader('Refresh'));
|
|
|
- if (rf && ok)
|
|
|
- setTimeout(() => window.location.reload(), rf * 1000);
|
|
|
+ // Optionally redirect elsewhere after success
|
|
|
+ const reft = parseFloat(form.dataset.ref) * 1000;
|
|
|
+ if (ok && reft >= 0.0) {
|
|
|
+ const refh = form.dataset.refUrl || window.location.href;
|
|
|
+ setTimeout(() => { window.location.href = refh; }, reft);
|
|
|
+ }
|
|
|
}, PassiveListener);
|
|
|
|
|
|
xhr.open(form.method, form.action);
|