带有 PDFjs 安全策略错误的 Phonegap Cordova

Phonegap Cordova with PDFjs securtiy policy error

我正在使用 Adob​​e PhoneGap 6.3.3,我正在尝试在具有 PFDjs 的混合 android 应用程序中显示 PDF。在浏览器中,pdf 是 diplayed,从手机安装 PhoneGap App Develover 它不起作用。在控制台中,我收到此消息:

Content Security Policy has been modified to be: <meta
 http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: 'un
safe-inline' https://ssl.gstatic.com * ws:;style-src 'self' 'unsafe-inline' data
: blob:;media-src *;script-src * 'unsafe-inline' 'unsafe-eval' data: blob:;">

我使用以下代码从互联网上阅读了 pdf:

    var url = 'http://www.example.com/foo.pdf';
    getBinaryData(url); //call this fn on page load 

    var callGetDocument = function (response) {
          // body...
          PDFJS.getDocument(response).then(function getPdfHelloWorld(_pdfDoc) {
            console.log('File caricato');
            pdfFile = _pdfDoc;
            openPage(pdfFile, currPageNumber, 1);

          });
        }


    var getBinaryData = function (url) {
        console.log('getBinaryData');
        // body...
        var xhr = new XMLHttpRequest();

        xhr.open('GET', url, true);
        xhr.responseType = 'arraybuffer';
        xhr.onload = function(e) {
            //binary form of ajax response,
            callGetDocument(e.currentTarget.response);
        };

        xhr.onerror = function  () {
            // body...
            console.log("xhr error");
        }

        xhr.send();
    }

我还在config.xml中插入<allow-navigation href="http://*/*" />。 你能帮帮我吗

解决方案是here

这是一个 CSP(内容安全策略)问题。 我从 this 网站创建了一个 CSP,并在我的 index.html

中插入了元标记