function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
병훈 송병훈 송 

Lightning component, hidden element click is not working in IE

My code : 

var hiddenElement = document.createElement('a');
            
            hiddenElement.href = 'data:application/vnd.ms-excel,' + encodeURI(component.get('v.excelTemp'));
            hiddenElement.target = '_blank';
            hiddenElement.download = supplier + ' ' + today.getFullYear() + monthDigit + dayDigit + '.xls'; 
            hiddenElement.click();


This code is working in CHROME..
and... not working in IE

How do I make it work in IE?
Arun ParmarArun Parmar
Hi ,
 You have to add this element in body. likle this, please try it.
           
hiddenElement.href = 'data:application/vnd.ms-excel,' + encodeURI(component.get('v.excelTemp'));
            hiddenElement.target = '_blank';
            hiddenElement.download = supplier + ' ' + today.getFullYear() + monthDigit + dayDigit + '.xls'; 
           document.body.appendChild(hiddenElement);
            hiddenElement.click();