Skip to content

Commit

Permalink
fix for chrome/edge file downloads with meshcentral assistant #5659
Browse files Browse the repository at this point in the history
Signed-off-by: si458 <simonsmith5521@gmail.com>
  • Loading branch information
si458 committed Jan 2, 2024
1 parent 10b6840 commit 97a624e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions views/default.handlebars
Expand Up @@ -18585,14 +18585,12 @@
function safeNewWindow(url, target) { var newWindow = window.open(url, target, 'noopener,noreferrer'); if (newWindow) { newWindow.opener = null; } }
function isWindowsNode(node) { if ((node.mtype != 2) || (node.agent == null) || (node.agent.id == null)) return false; return ([1,2,3,4,21,22,34,42,43].indexOf(node.agent.id) >= 0); }

// Webkit seems to have a problem with "download" tag causing "network error", but openning the download in a hidden frame fixes it.
// So we do that for all browsers except FireFox
function downloadFile(link, name, closeDialog) {
var element = document.createElement('a');
element.setAttribute('href', link);
element.setAttribute('rel', 'noreferrer noopener');
element.setAttribute('target', 'fileDownloadFrame');
if (navigator.userAgent.indexOf('Firefox') >= 0) { element.setAttribute('download', decodeURIComponent(name?name:'')); }
element.setAttribute('download', decodeURIComponent(name?name:''));
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
Expand Down

0 comments on commit 97a624e

Please sign in to comment.