Allows to render HTML files on git forges (like GitHub) in your browser, without cloning or downloading.
Warning
Freely hosted CORS (Cross-origin resource sharing) proxies - like the ones used by this script - are a potential security risk!
Warning
If a script stores sensitive data (as cookie, localStorage
, etc...), then other repos you open will also have access to this data.
How to avoid risk:
- Don't input sensitive data while previewing
- Clear all site data after previewing a repo
Currently supported git forges:
- GitHub
- BitBucket
- GitLab
- gitlab.com
- lab.allmende.io
- gitlab.opensourceecology.de
- ForgeJo
- codeberg.org
- SourceHut
- Gitea
We have a collection of the file URLs for the above.
If you try to open raw version of any HTML, CSS or JS file in a web browser directly from GitHub, all you will see is its source code. GitHub forces them to use the "text/plain" content-type, so they cannot be interpreted in their native form by the browser.
In order to use it, just prepend this fragment to the URL of any HTML file: https://html-preview.github.io/?url= e.g.:
- https://html-preview.github.io/?url=https://github.com/twbs/bootstrap/gh-pages/2.3.2/index.html
- https://html-preview.github.io/?url=https://github.com/documentcloud/backbone/blob/master/examples/todos/index.html
What it does:
- Load HTML using CORS proxy
- Process all links, frames, scripts and styles, and
- Load each of them using CORS proxy, so they can be evaluated by the browser.
Git-Forge HTML Preview was tested under the latest Google Chrome and Mozilla Firefox (in 2012).