I have a Base64 encoded document which can be PDF file or image. I would like to create a button in HTML5 page that opens this base64 in a new tab (or new page it does not m
I am adding the answer to my questiion based on Aaron's answer:
document.getElementById('btnDownload').addEventListener('click', function(){
var w = window.open('about:blank');
setTimeout(function(){ //FireFox seems to require a setTimeout for this to
work.
w.document.body.appendChild(w.document.createElement('iframe'))
.src = $this.attr('href');
w.document.getElementsByTagName("iframe")[0].style.width = '100%';
w.document.getElementsByTagName("iframe")[0].style.height = '100%';
}, 0);
});