Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to Run HTML files in your Browser from GitHub

DZone's Guide to

How to Run HTML files in your Browser from GitHub

· Web Dev Zone
Free Resource

Learn how to build modern digital experience apps with Crafter CMS. Download this eBook now. Brought to you in partnership with Crafter Software

If you have a .html file in a GitHub repository and want to view that page directly, you would typically download or clone the repo to your local hard drive and run it from there.

There is an easier way

Simply navigate to the repo in your GitHub account that contains a HTML file as shown below:

image

Right-click the index.html file and select copy link address.

image

You should have a URL similar to the following structure:

https://github.com/<your user name>/<your repo>/blob/master/index.html

Enter rawgit.com

As the name implies, rawgit shows serves the raw files directly from Github.

To use it simply use the following format:

https://rawgit.com/<your user name>/<your repo>/master/index.html

If you want to use it in production, you can use:

https://cdn.rawgit.com/<your user name>/<your repo>/master/index.html

That was easy now, wasn’t it!

Crafter is a modern CMS platform for building modern websites and content-rich digital experiences. Download this eBook now. Brought to you in partnership with Crafter Software.

Topics:

Published at DZone with permission of Michael Crump. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}