0

I have an application with ASP.NET Core back end, and Angular front end. Client has the following code:

this.myService.getSummary(this.personId, summaryType).subscribe(res => {
    let url = window.URL.createObjectURL(res.body);
    this.innerHtml = this.sanitizer.bypassSecurityTrustHtml(
        "<object data='" + url + "' type='application/pdf' class='embed-responsive-item' style='width: 100%; height: 500px;'>" +
            "Object " + url + " failed" +
         "</object>");
    this.loaderService.commonLoader = false;
}

Generated HTML is, as expected:

<object data="blob:https://myserver.com/f612fd9e-0656-41a2-b371-e6a13a8603e5" type="application/pdf" class="embed-responsive-item" style="width: 100%; height: 500px;">
Object blob:https://myserver.com/f612fd9e-0656-41a2-b371-e6a13a8603e5 failed
</object>

I can see that the PDF comes from the server correctly, and on most computers it is displayed properly. However, there are a few machines where I get

Object blob:https://myserver.com/f612fd9e-0656-41a2-b371-e6a13a8603e5 failed

Non-embedded PDFs are shown correctly, and I can even open this blob:https://myserver.com/f612fd9e-0656-41a2-b371-e6a13a8603e5 in a new tab.

Since it is happening on only a few machines, it's probably something in the environment. Maybe some Acrobat settings or whatever. My question is how can I troubleshoot this problem in client environment? I don't get any error in the console or in Windows event viewer. The problem happens in both Chrome and Edge.

Felix
  • 9,248
  • 10
  • 57
  • 89
  • take a look at https://stackoverflow.com/questions/1244788/embed-vs-object, maybe helps! Maybe also check the content of the object after x seconds! – mehany Oct 23 '19 at 21:20
  • interesting. thank you @mehany. I'll put embed and/or a instead of error message and see if it will provide a valid workaround! Who would've thought that 10-year-old be so helpful – Felix Oct 23 '19 at 22:39

0 Answers0