comparison Applications/StoneWebViewer/WebApplication/app.js @ 1718:65c03d33c345

use "window.location" instead of "window.open()" to download archives
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 01 Dec 2020 10:21:37 +0100
parents a878e807cd96
children b8d19f53aaca
comparison
equal deleted inserted replaced
1717:391c798e4dae 1718:65c03d33c345
935 .then(function(response) { 935 .then(function(response) {
936 console.log('Progress of archive job ' + that.archiveJob + ': ' + response.data['Progress'] + '%'); 936 console.log('Progress of archive job ' + that.archiveJob + ': ' + response.data['Progress'] + '%');
937 var state = response.data['State']; 937 var state = response.data['State'];
938 if (state == 'Success') { 938 if (state == 'Success') {
939 that.creatingArchive = false; 939 that.creatingArchive = false;
940 window.open(that.globalConfiguration.OrthancApiRoot + '/jobs/' + that.archiveJob + '/archive'); 940 var uri = that.globalConfiguration.OrthancApiRoot + '/jobs/' + that.archiveJob + '/archive';
941
942 /**
943 * The use of "window.open()" below might be blocked
944 * (depending on the browser criteria to block popup).
945 * As a consequence, we prefer to set "window.location".
946 * https://www.nngroup.com/articles/the-top-ten-web-design-mistakes-of-1999/
947 **/
948 // window.open(uri, '_blank');
949 window.location = uri;
941 } 950 }
942 else if (state == 'Running') { 951 else if (state == 'Running') {
943 setTimeout(that.CheckIsDownloadComplete, 1000); 952 setTimeout(that.CheckIsDownloadComplete, 1000);
944 } 953 }
945 else { 954 else {