2016-09-20 14 views
0

我正在開發使用WEB API2和AngularJS開發的預測。我使用pdfmake.js創建PDF格式的報告。它適用於Firefox。但出於安全原因,我想限制用戶使用Internet Explorer。因爲我需要使用MAC地址來識別用戶終端。我無法打開由PDFMake.js在Internet Exploer生成的新選項卡上創建的PDF

所以我命令用戶使用Internet Explorer。在Internet Explorer中,當我想打開PDF新標籤,PDFMake.js上以下行收到錯誤:

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; 
    } 
}; 

win.location.href = result;發生錯誤:

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

我用Google搜索並沒有得到任何解決這個問題。

回答

0

以下是可以解決問題的東西 -

  1. 嘗試使用window.location.href代替。
  2. 使用document.location.href嘗試,而不是

也爲更多的

閱讀 this link
相關問題