79168897

Date: 2024-11-08 05:27:45
Score: 0.5
Natty:
Report link

im use this code to fix js. download multiple file with new tabs

function downloadFilesInNewTabs(fileArray) {
    top.sapphire.alert('Starting file downloads in new tabs', true);
    fileArray.forEach((file, index) => {
        const url = "WEB-CUSTOM/Download/DownloadFile_00.jsp?filepath=WEB-CUSTOM/ControlChart/Output/" + file;
        const newTab = window.open(url, '_blank');

        if (!newTab) {
            console.error(`Failed to open new tab for file: ${file}`);
            top.sapphire.alert(`Failed to open new tab for file: ${file}`, true);
        }
    });
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: patipat nuntapet