rgrove / rawgit

Served files from raw.githubusercontent.com, but with the correct content types. No longer actively developed.
https://rawgit.com
MIT License
2.39k stars 488 forks source link

CSS not loading? #138

Closed wolandscat closed 7 years ago

wolandscat commented 7 years ago

This is the URL of an HTML file that loads normally, including CSS when locally present on my machine: https://raw.githubusercontent.com/openEHR/specifications-RM/master/docs/ehr/ehr.html

When I view it using the rawgit generated URL (https://rawgit.com/openEHR/specifications-RM/master/docs/ehr/ehr.html), the CSS is not loading. The two CSS files resolve normally in a browser - the URLs can be seen near the top of the content in the HEAD section:

<link rel="stylesheet" href="http://www.openehr.org/releases/BASE/latest/resources/css/openehr.css">
<link rel="stylesheet" href="http://www.openehr.org/releases/BASE/latest/resources/css/pygments-murphy.css">

Any pointers as to why this isn't working?

rgrove commented 7 years ago

The RawGit URL is being served over https, but the CSS URLs use http. Some (most? all?) modern browsers won't load http content in a page that's served over https, for security reasons. You should ideally use https URLs for those CSS files, but if this isn't possible, you can switch to http for the RawGit URL and the CSS will load.

By the way, the best way to start debugging issues like this is to open your browser's developer console and look for warnings. This is what I see in Chrome:

170112na6g1

wolandscat commented 7 years ago

Ah - thanks very much. I'm a back-end guy, I hadn't realised the problem of http links embedded in https content (although obvious when you say it). I don't know if I am the only person in the universe to not realise the cause of this particular problem, but I wonder if it would make sense to mention it in the FAQ (which I did read) and potentially also the tip about using the Chome dev console tab (via Inspect page), which while blindingly obvious to many, is forgotten by some of us who don't develop directly for browers?