View Full Version : open a file created in JS

01-05-2011, 07:13 PM
I've been watching an application called JSPDF http://code.google.com/p/jspdf/ that creates a PDF file solely in client side javascript.
In a nutshell, it generates pdf bytes (called buffer), encodes the bytes into base64, and opens it in the browser:

document.location.href = 'data:application/pdf;base64,' + Base64.encode(buffer);
This works for me in firefox and chrome, but not IE. My question: is there a better way to reform the file download/opening in javascript? They provide an example with downloadify and that may be acceptable unless you are trying to eliminate flash from the equation.