How to link files directly from Github (raw.github.com)

后端 未结 10 2278
耶瑟儿~
耶瑟儿~ 2020-11-30 19:52

Are we allowed to link files directly from Github ?



        
10条回答
  •  再見小時候
    2020-11-30 20:26

    After searching for this same functionality, I ended up writing my own PHP script to act as a proxy. The trouble I kept running into is even when you get the RAW version/link from Github and link to it in your own page, the header sent over was 'text/plain' and Chrome was not executing my JavaScript file from Github. I also didn't like the other links posted for using third party services because of the obvious security/tampering issues possible.

    So using this script, I can pass over the RAW link from Github, have the script set the correct headers, and then output the file as if it were coming from my own server. This script can also be used with a secure application to pull in non-secure scripts without throwing SSL errors warning of "Non-secure links used".

    Linking:

    proxy.php

    
    

提交回复
热议问题