Skip to content

html-preview/html-preview.github.io

 
 

Repository files navigation

Git-Forge HTML Preview

License: Apache-2.0 REUSE status

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.

How it works

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.

Usage

In order to use it, just prepend this fragment to the URL of any HTML file: https://html-preview.github.io/?url= e.g.:

What it does:

  1. Load HTML using CORS proxy
  2. Process all links, frames, scripts and styles, and
  3. 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).