Can anyone help me out in solving this issue. I am using html blob in my JavaScript to download html grids into excel file. In Chrome and Mozilla its working fine but in safari browser it's showing error. The code and error is as follows:
var uri = 'data:application/vnd.ms-excel;base64,'
, template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]-->' +
'<meta http-equiv="content-type" content="text/plain; charset=UTF-8"/><style>thead td{font-weight:bold; background:rgb(149,179,215); color:#fff;}</style></head>' +
'<body><table><thead><tr><th>CustomerName</th><th>Selected Profile</th><th>Date Range</th></tr></thead><tbody><tr><td>' + customerName + '</td><td>' + worksheetName + '</td><td>' + displayFromDate + ' - ' + displayToDate + '</td></tr></tbody></table>' +
'<table>{selectorData}</table></body></html>'
, base64 = function (s) { return window.btoa(unescape(encodeURIComponent(s))) }
, format = function (s, c) { return s.replace(/{(\w+)}/g, function (m, p) { return c[p]; }) }
var grp = { worksheet: worksheetName || 'Worksheet', selectorData: ctx };
var blob = new Blob([format(template, grp)], { type: "application/xhtml" });
I am getting error in safari like this:
Type Error: '[object BlobConstructor]' is not a constructor (evaluating 'new Blob([c(h,l)])')
Can anyone resolve this issue?