javascript - Saving a file on Windows Phone 8.1 (mobile IE) -
i'm developing web application 1 may save configuration data json file on computer. approach works fine on desktop browsers (ie11, chrome, ff) , on tested android device. in mobile ie on wp8.1 there happens nothing , on ios devices file shown rather downloaded. here code:
var savetofile = function () { var = document.createelement("a"), blob = new blob([getuserconfigs()/*get json somewhere*/], {type:"application/json"}), fname = "fileabc"; //check ms ie fileapi if (window.navigator.mssaveblob) { a.onclick = function(e) { e.stoppropagation(); window.navigator.mssaveblob(blob, fname); }; //otherwise use html5 standard } else { a.setattribute("href", window.url.createobjecturl(blob)); a.setattribute("download", fname); a.onclick = function (e) { e.stoppropagation(); }; } document.body.appendchild(a); a.click(); document.body.removechild(a); }; $("#savebtn").click(savetofile);
what's missing? how work on mobile ie/safari? on desktop works fine. :)
Comments
Post a Comment