仅在托管应用程序时出现错误,但不在我的本地主机中

时间:2017-09-28 15:50:27

标签: javascript angular typescript firebase mixed-content

我一直在AngularJS 2工作,当在本地服务器托管时,我没有错误,一切都是okey。但是当它托管到firebase服务器时,控制台中会出现一些错误。这是链接......:

https://test-calculadora.firebaseapp.com

错误

此混合内容错误出现在Google Chrome和Firefox

  

混合内容:“https://test-calculadora.firebaseapp.com/”页面是通过HTTPS加载的,但是请求了一个不安全的样式表“http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,400,300,600”。此请求已被阻止;内容必须通过HTTPS提供。

此错误仅显示在Google Chrome中

ERROR TypeError: Cannot read property '0' of null
at Object.updateDirectives (3.ad64bef68a696aaec9de.chunk.js:1)
at Object.updateDirectives (vendor.be20388edeb374983d23.bundle.js:127)
at or (vendor.be20388edeb374983d23.bundle.js:127)
at mr (vendor.be20388edeb374983d23.bundle.js:127)
at gr (vendor.be20388edeb374983d23.bundle.js:127)
at or (vendor.be20388edeb374983d23.bundle.js:127)
at mr (vendor.be20388edeb374983d23.bundle.js:127)
at gr (vendor.be20388edeb374983d23.bundle.js:127)
at or (vendor.be20388edeb374983d23.bundle.js:127)
at mr (vendor.be20388edeb374983d23.bundle.js:127)

1 个答案:

答案 0 :(得分:1)

注意错误的链接是如何以“http”而不是“https”开头的。 http本来就是'不安全'。

'http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,400,300,600'

你应该能够在http中添加's',这应该可以解决问题。

谷歌不得不说:

  

在页面上加载资源时始终使用https://网址。使用   Content-Security-Policy-Report-Only标头用于监控混合内容   您网站上的错误。使用upgrade-insecure-requests CSP指令   保护您的访问者免受不安全内容的侵害。

了解详情here