Javascript fetch not working in internet explorer
I have implemented javascript fetch to call webapi in MVC view cshtml page. It is working in Chrome/Edge, but not working in IE. How to make fetch() work in IE.Below code used in my application for calling MVC action method using fetch()
<script src="//cdn.jsdelivr.net/bluebird/3.5.0/bluebird.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/2.0.3/fetch.js"></script>
$("#btnExcelDownload").click(function(){
window.fetch("/Home/DownloadExcelTemplate", {
method: 'GET',
headers: new Headers({
'AntiForgeryToken': 'XSS6GDB'
})
})
.then(response => response.blob())
.then(blob => {
var linkElement = document.createElement('a');
var url = URL.createObjectURL(blob);
linkElement.setAttribute('href', url);
linkElement.setAttribute("download", '@request.Name'+"_Catalog.xlsx");
//for Firefox
document.body.appendChild(linkElement);
linkElement.click();
document.body.removeChild(linkElement); });
});