I Can not open created PDF on new tab genered by PDFMake.js in Internet Exploer

0

I am working on a projected developed using WEB API2 and AngularJS. I am created report in PDF using pdfmake.js. It works fine for Firefox. But for security reason, I like to restrict the user to use Internet Explorer. Because I need to identify the user terminal using MAC Address.

So I commanded users to use Internet Explorer. In Internet explorer, When I want to open the PDF new tab, PDFMake.js getting error on following line:

Document.prototype.open = function(message) {
    // we have to open the window immediately and store the reference
    // otherwise popup blockers will stop us
    var win = window.open('', '_blank');

    try {
        this.getDataUrl(function(result) {
            win.location.href = result;
        });
    } catch(e) {
        win.close();
        throw e;
    }
};

The line win.location.href = result; generating error :

Unhandled exception at line 110, column 8 in http://localhost:19884/Scripts/pdfmake/pdfmake.js 0x8007007a - JavaScript runtime error: unknown exception

Image of the error message

I googled and didn't get any solution of this problem.

angularjs
internet-explorer
pdf
window.location
pdfmake
asked on Stack Overflow Sep 20, 2016 by Sadequzzaman Monoj • edited Sep 20, 2016 by halfer

1 Answer

0

Following are the things which can solve the issue -

  1. Try using window.location.href instead.
  2. Try using document.location.href instead

Also read this link for more

answered on Stack Overflow Sep 20, 2016 by Techidiot • edited May 23, 2017 by Community

User contributions licensed under CC BY-SA 3.0