forked from snxraven/LinkUp-P2P-Chat
Adding buttons instead of links for downloads
This commit is contained in:
parent
3dcabac0b4
commit
d0d408230a
14
app.js
14
app.js
@ -456,11 +456,15 @@ function addFileMessage(from, fileName, fileUrl, fileType, avatar) {
|
|||||||
$image.classList.add('attached-image');
|
$image.classList.add('attached-image');
|
||||||
$content.appendChild($image);
|
$content.appendChild($image);
|
||||||
} else {
|
} else {
|
||||||
const $fileLink = document.createElement('a');
|
const $fileButton = document.createElement('button');
|
||||||
$fileLink.href = fileUrl;
|
$fileButton.textContent = `Download File: ${fileName}`;
|
||||||
$fileLink.textContent = `File: ${fileName}`;
|
$fileButton.onclick = function() {
|
||||||
$fileLink.download = fileName;
|
const $fileLink = document.createElement('a');
|
||||||
$content.appendChild($fileLink);
|
$fileLink.href = fileUrl;
|
||||||
|
$fileLink.download = fileName;
|
||||||
|
$fileLink.click();
|
||||||
|
};
|
||||||
|
$content.appendChild($fileButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
$div.appendChild($content);
|
$div.appendChild($content);
|
||||||
|
Loading…
Reference in New Issue
Block a user