From ce5afab66ea96d9d4150d1abdd8ea50fbcf707bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 7 Dec 2023 22:50:42 +0100 Subject: [PATCH] Duplicate object tag when updating the content of Document widget Some browser does not refresh properly the content when updating the data attribute. Closes #12808 --- sao/src/view/form.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sao/src/view/form.js b/sao/src/view/form.js index a70c553fd1..4eb242b552 100644 --- a/sao/src/view/form.js +++ b/sao/src/view/form.js @@ -4538,12 +4538,16 @@ function eval_pyson(value){ }); url = window.URL.createObjectURL(blob); } + // duplicate object to force refresh on buggy browsers + const object = this.object.clone(); // set onload before data to be always called - this.object.get(0).onload = function() { + object.get(0).onload = function() { this.onload = null; window.URL.revokeObjectURL(url); }; - this.object.attr('data', url); + object.attr('data', url); + this.object.replaceWith(object); + this.object = object; }); }, });