This is really starting to but me.
I am using nativefire to create a desktop application out of an web app and one thing I can't seem to achieve is to allow file downloads.
I have a script that turns a table into an excel file and also a backup function and both should download files which in the browser works nicely but after creating the desktop app, nothing happens after clicking the buttons.
Did anyone find a way to achieve this?
- Version of Nativefier: v7.0.1
- Version of Node.js: v6.9.1
- OS: Windows 7
- Architecture 64
JS code that doesn't work in nativefier generated app but DOES in browser:
function fnExcelReport() { var tab_text="<table border='1px'><tr bgcolor='#ebebeb'>"; var textRange; var j=0; tab = document.getElementById('Export'); for(j = 0 ; j < tab.rows.length ; j++) { tab_text=tab_text+tab.rows[j].innerHTML+"</tr>"; } tab_text=tab_text+"</table>"; tab_text= tab_text.replace(/<a[^>]*>|<\/a>/g, ""); tab_text= tab_text.replace(/<img[^>]*>/gi,""); tab_text= tab_text.replace(/<input[^>]*>|<\/input>/gi, ""); var ua = window.navigator.userAgent; var msie = ua.indexOf("MSIE "); if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) { txtArea1.document.open("txt/html","replace"); txtArea1.document.write(tab_text); txtArea1.document.close(); txtArea1.focus(); sa=txtArea1.document.execCommand("SaveAs",true,"Say Thanks to Sumit.xls"); } else sa = window.open('data:application/vnd.ms-excel,' + encodeURIComponent(tab_text)); return (sa); }
0 comments:
Post a Comment