We have an Angular application that gets some input parameters and sends them to the back end where they get processed. The processing result is a pdf file that we want to open in a new tab.
The code doing this looks similar with below:
myService.getDocument(document)
.then(function(response) {
if (response.error) {
// Error handling goes here
} else {
var file = new BLob([response.data), {type: 'application/pdf'});
var fileURL = URL.createObjectURL(file);
$window.open(fileURL, '_blank_');
}
});
Everything works fine but the URL in the browser shows some random generated string as below:
blob:http://localhost:3000/85cad96e-e44e-a1f9-db97a96ed3fe
Obviously this does not look very good to the end user and we would prefer to display something which is meaningful to the user, say something like below:
blob:ftp://localhost:3000/my_document_name_or_whatever
I am new to JS, new to Angular, new to HTML and hope my question does not sounds very naive.
Thank you in advance for your inputs.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…