javascript - How to prevent blob + guid in browser title -
basically, doing generating pdf file on server , showing in browser via javascript 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 works fine every browser showing ugly subtitle (something this): blob:2da57927-311e-4b3d-a261-d2679074802c
is there way rid of subtitle or replace meaningful?
edited: here screen capture of improved code (after applying vision's suggestion):
as mentioned in comments, 1 possible way make <iframe>
in popup window, displays current blob
data, , style popup 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;
Comments
Post a Comment