This works just fine in FireFox, but when I click the activating button that calls this function in Microsoft Edge nothing happens...no prompt to download or open the file, no errors...no logs...nothing. Any help you guys could provide would be greatly appreciated. Thanks!!!!
let val:string='';
let valList = [] ;
let valStr:string = '';
let keysItr = Object.keys(this.policies[0]);
let keyList = Array.from(keysItr);
let keyStr = keyList.toString() ;
keyStr = keyStr.trim() ;
keyStr = keyStr.concat('\n');
for(var i = 0 ; i < this.policies.length ; i++ ){
for (let key of Object.keys(this.policies[i])) {
val = this.policies[i][key] ;
if(val == null){
val = '';
}
val = val.toString() ;
val = val.replace('$','');
val = val.replace(',','');
valList.push(val);
//console.log(val);
}
valStr = valStr.concat(valList.toString());
valStr = valStr.trim() ;
valStr = valStr.concat('\n');
valList = [] ;
}
let csvStr = keyStr.concat(valStr);
var element = document.createElement('a');
element.setAttribute('href', 'data:text/csv;charset=utf-8,' + encodeURIComponent(csvStr));
element.setAttribute('download', 'FOOBAR.csv');
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}//end fooBar()```