Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
69
rated 0 times [  72] [ 3]  / answers: 1 / hits: 8834  / 10 Years ago, fri, june 27, 2014, 12:00:00

Basically, what I am doing is generating a PDF file on the server and showing it in the browser via javascript like this:



  file = new window.Blob([data], { type: 'application/pdf' });
var fileUrl = URL.createObjectURL(file);
var wnd = window.open(fileUrl, _blank, location=no, fullscreen=yes, scrollbars=auto, width= + screen.width + ,height= + screen.height);


All this works fine but every browser is showing an ugly subtitle (something like this): blob:2da57927-311e-4b3d-a261-d2679074802c



Is there any way to get rid of this subtitle or to replace it with something meaningful?



Edited:
Here is a screen capture of the improved code (after applying VisioN's suggestion):



enter


More From » html

 Answers
1

As I mentioned in the comments, one possible way is to make an <iframe> in the popup window, that displays the current Blob data, and to style the popup as you wish:



var win = open('', 'name', 'height=300, width=300'),
iframe = document.createElement('iframe'),
title = document.createElement('title'),
file = new Blob([data], { type: 'application/pdf' }),
fileUrl = URL.createObjectURL(file);

title.appendChild(document.createTextNode('Nice title :)'));

iframe.src = fileUrl;
iframe.width = '100%';
iframe.height = '100%';
iframe.style.border = 'none';

win.document.head.appendChild(title);
win.document.body.appendChild(iframe);
win.document.body.style.margin = 0;


DEMO: http://jsfiddle.net/MeY9e/


[#44275] Thursday, June 26, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
keric

Total Points: 572
Total Questions: 93
Total Answers: 97

Location: Cyprus
Member since Mon, Oct 24, 2022
2 Years ago
;