拒绝加载样式表'......',因为它违反了以下内容安全策略

时间:2017-06-22 16:25:25

标签: javascript css meteor browser cross-browser

我正在研究如何解决这个问题。我正在开发一个实现浏览器策略的应用程序。根据此处的文档[https://themeteorchef.com/tutorials/using-the-browser-policy-package][1],我添加了允许某些域名的选项,例如google fonts,w3schools css。令我惊讶的是,所有选项集都会导致更大的错误。我不知道该怎么办。请帮助。

这是代码:

Meteor.startup( () => {
    BrowserPolicy.content.allowEval();
    BrowserPolicy.content.allowInlineStyles();
    BrowserPolicy.content.allowInlineScripts();
    BrowserPolicy.content.allowStyleOrigin('w3schools.com');
    BrowserPolicy.content.allowOriginForAll( 'fonts.googleapis.com' );
});

这是错误消息:

    Refused to load the stylesheet 'https://www.w3schools.com/w3css/4/w3.css' because it violates the following Content Security Policy directive: "style-src 'self' 'unsafe-inline' http://w3schools.com https://w3schools.com http://fonts.googleapis.com https://fonts.googleapis.com".

    home:10 Refused to load the stylesheet 'https://www.w3schools.com/lib/w3-theme-blue-grey.css' because it violates the following Content Security Policy directive: "style-src 'self' 'unsafe-inline' http://w3schools.com https://w3schools.com http://fonts.googleapis.com https://fonts.googleapis.com".

    home:157 Refused to load the stylesheet 'https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.13/css/bootstrap-multiselect.css' because it violates the following Content Security Policy directive: "style-src 'self' 'unsafe-inline' http://w3schools.com https://w3schools.com http://fonts.googleapis.com https://fonts.googleapis.com".

    home:181 Refused to load the script 'http://www.google-analytics.com/ga.js' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline' 'unsafe-eval' http://fonts.googleapis.com https://fonts.googleapis.com".

    (anonymous) @ home:181
    (anonymous) @ home:182
    home:204 Refused to load the stylesheet 'https://www.w3schools.com/w3css/4/w3.css' because it violates the following Content Security Policy directive: "style-src 'self' 'unsafe-inline' http://w3schools.com https://w3schools.com http://fonts.googleapis.com https://fonts.googleapis.com".

    home:205 Refused to load the stylesheet 'https://www.w3schools.com/lib/w3-theme-blue-grey.css' because it violates the following Content Security Policy directive: "style-src 'self' 'unsafe-inline' http://w3schools.com https://w3schools.com http://fonts.googleapis.com https://fonts.googleapis.com".

    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/sourcesanspro/v10/toadOcfmlt9b38dHJxOBGKhisFFF-0ifc-Simo8uwJs.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/sourcesanspro/v10/toadOcfmlt9b38dHJxOBGNJvocFWY_5VFjYFbAOOIik.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/sourcesanspro/v10/toadOcfmlt9b38dHJxOBGLGN1mc631ObjHzqJB_dFFA.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/sourcesanspro/v10/toadOcfmlt9b38dHJxOBGI3P6ux3HwbL10a8ofNXGLA.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/sourcesanspro/v10/toadOcfmlt9b38dHJxOBGD_j0nMiB9fPhg_k1wdK2h0.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/sourcesanspro/v10/toadOcfmlt9b38dHJxOBGDRVvBvQIc1z78c__uoBcyI.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/sourcesanspro/v10/toadOcfmlt9b38dHJxOBGOode0-EuMkY--TSyExeINg.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/sourcesanspro/v10/toadOcfmlt9b38dHJxOBGMKLL5CtqrIC1MmqTPxryYA.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/sourcesanspro/v10/toadOcfmlt9b38dHJxOBGLttwilxDzpVRPUtYE2He8E.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/sourcesanspro/v10/toadOcfmlt9b38dHJxOBGMqNlGGfRq7bLR7KpoutytU.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/sourcesanspro/v10/toadOcfmlt9b38dHJxOBGDN0peKJ_L8b-UGHSLXfhhU.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/sourcesanspro/v10/toadOcfmlt9b38dHJxOBGLpVETArfVi9McBbsQ4atuQ.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/sourcesanspro/v10/toadOcfmlt9b38dHJxOBGEfh7q1GW6w7vv_rRnRqMrY.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/sourcesanspro/v10/toadOcfmlt9b38dHJxOBGHZhYM0_6AejPZE-OqA592o.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'data:application/font-woff2;charset=utf-8;base64,d09GMgABAAAAAFQ0ABEAAAAAvI…rnptIwTkWGE9bL/2LchXN+inLcDLxE7fAT7xFB4hM6CbaEib4mSsIr4jjCV4pIX7nsL37WAw==' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAGoUABEAAAAAvJA…yA/lwxAAf/NQSDtWIEhivFGIyWigkYLxSHYJIrpuCQK47ANGwpKOEfDz5cKAAAAAABViuSJAAA' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'data:application/font-woff2;charset=utf-8;base64,d09GMgABAAAAAFQwABEAAAAAu+…TMo+yMPA6lZ2QRKDkj9UHxGYkaRWfE00yl+QXhIKt7l1TvpYyaq9tpVfMDKs1aPYiU6adsBAAA' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAGsMABEAAAAAu+g…HK0icGuaVH9BeWLtFLLadE92YZ9x/IQ8dskvRJDOk/SWmS7H40mOk31btNXAAAAAFWK5GuAAA=' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/opensans/v14/K88pR3goAWT7BTt32Z01mxJtnKITppOI_IvcXXDNrsc.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/opensans/v14/RjgO7rYTmqiVp7vzi-Q5URJtnKITppOI_IvcXXDNrsc.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/opensans/v14/LWCjsQkB6EMdfHrEVqA1KRJtnKITppOI_IvcXXDNrsc.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/opensans/v14/xozscpT2726on7jbcb_pAhJtnKITppOI_IvcXXDNrsc.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/opensans/v14/59ZRklaO5bWGqF5A9baEERJtnKITppOI_IvcXXDNrsc.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/opensans/v14/u-WUoqrET9fUeobQW7jkRRJtnKITppOI_IvcXXDNrsc.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/opensans/v14/cJZKeOuBrn4kERxqtaUH3VtXRa8TVwTICgirnJhmVJw.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    meteorInstall.node_modules.meteor.es5-shim.client.js @ es5-shim.js?hash=adc3c62…:33
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130
    (anonymous) @ es5-shim.js?hash=adc3c62…:2783
    (anonymous) @ es5-shim.js?hash=adc3c62…:2789
    es5-shim.js?hash=adc3c62…:1143 Refused to load the font 'https://fonts.gstatic.com/s/opensans/v14/K88pR3goAWT7BTt32Z01mxJtnKITppOI_IvcXXDNrsc.woff2' because it violates the following Content Security Policy directive: "default-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

    (anonymous) @ es5-shim.js?hash=adc3c62…:1143
    (anonymous) @ es5-shim.js?hash=adc3c62…:1151
    $Array @ es5-shim.js?hash=adc3c62…:164
    es5-shim.js @ es5-shim.js?hash=adc3c62…:169
    fileEvaluate @ modules-runtime.js?hash=2b888cb…:207
    require @ modules-runtime.js?hash=2b888cb…:130

https://themeteorchef.com/tutorials/using-the-browser-policy-package

1 个答案:

答案 0 :(得分:2)

您的代码似乎很好。我不太确定,但请尝试将https放入您的链接中:

//...
BrowserPolicy.content.allowStyleOrigin('https://w3schools.com');
BrowserPolicy.content.allowOriginForAll('https://fonts.googleapis.com');
//...