fixing nosniff block when using github code as library

as far we know, github blocks raw code usage as http requests by using nosniff attribute. also website named rawgit stopped working too.

right now the only way to access library on github is to use pages feature (note - you need to have administrator access to a repo and be able to turn on pages for repo with library)

how to do it then?

  1. firstly go to repository settings
  2. enable pages on root of branch your library is in
  3. github pages links look like: (user).github.io/(repo)/(file) , so for example an css stylesheet link might look like : https://user.github.io/library/main.css
  4. assemble such link and update your codes

why does it work?

if you make a webpage on github you arent forced to put all your code into single html file.

github respects that you might link subfiles to a main index.html or other sub-webpage.

when you use a link from pages feature github doesnt have any way to check if you use that library inside page on same repo or outside but because its intended to display pages, even with external files so it cant enable nosniff mode cause otherwise pages could broke (and only index.html site could be then displayed).