I am using this https://github.com/eligrey/FileSaver.js to save web page as html.
Following code executes when user clicks download-
var originalstr=$.ajax(
{
type: "GET",
url:"url",
async: false
}).responseText ;
var str = $(originalstr).find('.toolbar').remove().end();
saveAs(new Blob([ str], {type: "text/html;charset=utf-8"}), "Plan_Enrollment_Show_All.HTML");
I get the response and i am removing a div tag with class name "toolbar" and then i am sending it to saveAs function of the FileSaver.js.
I am getting the web page with "[object Object]" as the content file which got downloaded.
If i don't do any modification and pass the originalstr then i get the proper output. Any help regarding this?
I have taken the escaped html and tried constructing the html by removing the div and it worked. For escaping the html i used this http://www.freeformatter.com/javascript-escape.html#ad-output but when i try to do escaping using escape() function of javascript i get different response.
Demo of removing the tag with class- https://jsfiddle.net/SkyTreasure/zfzocuf2/