Issue
GitHub's "view raw" feature displays an HTML file's source code, but I don't understand, why does this not render in the browser? From what I can tell, this should look just like any other webpage -- it starts off with <!DOCTYPE html>
, is valid HTML, and viewing view-source:https://raw.githubusercontent.com/me/myrepo/main/myfile.html
shows the exact same thing, so there can't be any kind of wrapper that tells the browser to not render it.
What is special about raw.githubusercontent.com
that allows content to not render?
Solution
GitHub's web server response returns a Content-Type header of text/plain
.
The web browser doesn't render based on the .html file extension. It's based on the Content-Type.
To see the headers, try this:
curl -D- -o/dev/null -s YOUR_URL_HERE
Answered By - Andy Lester
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.