The only thing I can think of is to change the settings of Firefox. I assume you cannot do this.
EDIT:
I have combined a client solution based on the idea of ββa data URI. It uses a modified version of the base64 encoder and the binary XMLHTTPrequests script technique downloads the PDF file, then generates and places the data URI link dynamically using the base64 encoder.
This should be useful when you want to encode an octet stream, but don't have access to the server (as this seems to apply to the OP).
Notice, I just posted an example using hunts.pdf with which the OP was tested.
/** * * Base64 encode / decode * http://www.webtoolkit.info/ * **/ var Base64 = { // private property _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", // public method for encoding encode : function (input) { var output = ""; var chr1, chr2, chr2raw, chr3, chr3raw, enc1, enc2, enc3, enc4; var i = 0; //input = Base64._utf8_encode(input); while (i < input.length) { chr1 = input.charCodeAt(i++) & 0xFF; chr2 = isNaN(chr2raw = input.charCodeAt(i++)) ? NaN : (chr2raw & 0xFF); chr3 = isNaN(chr3raw = input.charCodeAt(i++)) ? NaN : (chr3raw & 0xFF); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); } return output; } } // http://web.archive.org/web/20071103070418/mgran.blogspot.com/2006/08/downloading-binary-streams-with.html //fetches BINARY FILES synchronously using XMLHttpRequest load_url = function(url) { var req = new XMLHttpRequest(); req.open('GET',url,false); //XHR binary charset opt by Marcus Granado 2006 [http://mgran.blogspot.com] req.overrideMimeType('text/plain; charset=x-user-defined'); req.send(null); if (req.status != 200){ alert(req.status); return ''; } return req.responseText; } function getDataURI(filename) { var file = load_url(filename); var uueFile = Base64.encode(file); var uri = 'data:application/octet-stream;base64,' + encodeURIComponent(uueFile); return uri; } window.addEventListener("load", function() { var link = getDataURI("foo.pdf"); document.getElementById("myDiv").innerHTML += '<a href="' + link + '"><code>' + link + '</code></a><br><br>'; }
Matthew Flaschen May 07 '09 at 5:57 a.m. 2009-05-07 05:57
source share