"GitHub CDN 사용하기"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
(사용자 3명의 중간 판 15개는 보이지 않습니다)
3번째 줄: 3번째 줄:


==문제상황==
==문제상황==
<source lang='html5'>
*raw.githubusercontent.com 로 접근하면 거부됨
<syntaxhighlight lang='html5'>
<link rel="stylesheet" href="//raw.githubusercontent.com/xdan/datetimepicker/master/jquery.datetimepicker.css">
<link rel="stylesheet" href="//raw.githubusercontent.com/xdan/datetimepicker/master/jquery.datetimepicker.css">
<script src="//raw.githubusercontent.com/xdan/datetimepicker/master/jquery.datetimepicker.js"></script>
<script src="//raw.githubusercontent.com/xdan/datetimepicker/master/jquery.datetimepicker.js"></script>
</source>
</syntaxhighlight>
<source lang='text'>
{{인용문|
datetimepicker2.php:1 Refused to execute script from 'http://raw.githubusercontent.com/xdan/datetimepicker/master/jquery.datetimepicker.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
datetimepicker2.php:1 Refused to execute script from 'http://raw.githubusercontent.com/xdan/datetimepicker/master/jquery.datetimepicker.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
</source>
}}


==해결방법==
==해결방법==
<source lang='html5'>
* https://raw.githack.com/ 에 가서 URL을 입력하면 CDN 주소로 바꿔줌
<link rel="stylesheet" href="//cdn.rawgit.com/xdan/datetimepicker/master/jquery.datetimepicker.css">
* 또는 아래와 같이 수동으로 URL을 바꿔도 사용 가능하나 이경우 업데이트가 제때 안될수 있음
<script src="//cdn.rawgit.com/xdan/datetimepicker/master/jquery.datetimepicker.js"></script>
:https://github.com/xdan/datetimepicker/blob/master/jquery.datetimepicker.css
</source>
:→ https://rawcdn.githack.com/xdan/datetimepicker/master/jquery.datetimepicker.css
* 브랜치가 아닌 특정 커밋, 태그 등 불변하는 것을 기준으로 링크를 만들어야 안전함
 
<syntaxhighlight lang='html5'>
<link rel="stylesheet" href="https://rawcdn.githack.com/xdan/datetimepicker/82a256409f0af54e4d1fd074b312fa579a122d38/jquery.datetimepicker.css">
<script src="/https://rawcdn.githack.com/xdan/datetimepicker/82a256409f0af54e4d1fd074b312fa579a122d38/jquery.datetimepicker.js"></script>
</syntaxhighlight>


==같이 보기==
==같이 보기==
*[[JQuery 날짜시간선택기 datetimepicker]]
*[[JQuery 날짜시간선택기 datetimepicker]]
*[[RawGit]]
*[[GitHub]]
*[[GitHub]]
*[[CDN]]
*[[CDN]]
==참고==
*http://stackoverflow.com/questions/17341122/link-and-execute-external-javascript-file-hosted-on-github


[[분류: GitHub]]
[[분류: GitHub]]
[[분류: CDN]] ‎
[[분류: CDN]] ‎

2020년 11월 2일 (월) 00:55 기준 최신판

GitHub CDN 사용하기
Refused to execute script from http://raw.githubusercontent.com

1 문제상황[ | ]

  • raw.githubusercontent.com 로 접근하면 거부됨
<link rel="stylesheet" href="//raw.githubusercontent.com/xdan/datetimepicker/master/jquery.datetimepicker.css">
<script src="//raw.githubusercontent.com/xdan/datetimepicker/master/jquery.datetimepicker.js"></script>

datetimepicker2.php:1 Refused to execute script from 'http://raw.githubusercontent.com/xdan/datetimepicker/master/jquery.datetimepicker.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.

2 해결방법[ | ]

  • https://raw.githack.com/ 에 가서 URL을 입력하면 CDN 주소로 바꿔줌
  • 또는 아래와 같이 수동으로 URL을 바꿔도 사용 가능하나 이경우 업데이트가 제때 안될수 있음
https://github.com/xdan/datetimepicker/blob/master/jquery.datetimepicker.css
https://rawcdn.githack.com/xdan/datetimepicker/master/jquery.datetimepicker.css
  • 브랜치가 아닌 특정 커밋, 태그 등 불변하는 것을 기준으로 링크를 만들어야 안전함
<link rel="stylesheet" href="https://rawcdn.githack.com/xdan/datetimepicker/82a256409f0af54e4d1fd074b312fa579a122d38/jquery.datetimepicker.css">
<script src="/https://rawcdn.githack.com/xdan/datetimepicker/82a256409f0af54e4d1fd074b312fa579a122d38/jquery.datetimepicker.js"></script>

3 같이 보기[ | ]

4 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}