How to make changes stick in fireapp that will be hosted using firebase hosting?

谁都会走 提交于 2019-12-05 18:01:08

It looks like your application is loading some script files over HTTP, while the application itself is served over HTTPS. This is causing some browsers to rejects the non-secure scripts.

For example Chrome writes this on its console when I load your app:

[blocked] The page at 'https://torid-fire-4332.firebaseapp.com/' was loaded over HTTPS, but ran insecure content from 'http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css': this content should also be loaded over HTTPS.".

In Internet Explorer 9, the page loads fine (after I confirm that I want to "Show all content"). My guess is that your mobile browsers behaves like IE9 and also still accept the combination of HTTP and HTTPS.

The solution is to load everything over HTTPS.

To prevent this type of problem, it is now in general common to specify script sources without a protocol:

<script src="//cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>

When this script tag is loaded, it "inherits" the protocol from its parent. So when the page is loaded over HTTPS, the script will be loaded over HTTPS. And when the page is loaded over HTTP, the script is also loaded over HTTP.

Update

Your second edit shows that after making that last change I suggested above, the update was successfully pushed to Firebase hosting. I doubt the actual change had anything to do with that success, but at least now we have progress.

The :ERR_INSECURE_RESPONSE you're getting is because cds.leafletjs.com doesn't see to use a valid HTTPS certificate.

It's probably easiest to solve this by putting the leaflet.js files in your own app.

You can also use an alternative CDN, that does implement HTTPS correctly. E.g. http://cdnjs.com/libraries/leaflet.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!