how can make code work in firefox 3.6?
its working in latest chrome , firefox browsers not old firefox 3.6 requirement project.
advance answering.
(function($) { $(document).ready(function() { function downloadinnerhtml(filename, elid, mimetype) { var elhtml = document.getelementbyid(elid).innerhtml; var link = document.createelement('a'); mimetype = mimetype || 'application/octet-stream'; link.setattribute('download', filename); link.setattribute('href', 'data:' + mimetype + ';charset=utf-8,' + encodeuricomponent(elhtml)); link.style.csstext = "position: aboslute !important; left: -9999px; visibility: hidden;"; //hide element link.innerhtml = "text"; document.body.appendchild(link); link.click(); settimeout(function() { document.body.removechild(link); //remove element }, 1); } var filename = 'logfile.txt'; // can use .txt extension if want $('#downloadlink').click(function() { downloadinnerhtml(filename, 'main', 'text/plain'); }); }); })(jquery);
i'm bit confused version naming mozilla corporation, see, firefox 3.6 not support data uri
Comments
Post a Comment