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

잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
(사용자 2명의 중간 판 3개는 보이지 않습니다)
4번째 줄: 4번째 줄:
==문제상황==
==문제상황==
*raw.githubusercontent.com 로 접근하면 거부됨
*raw.githubusercontent.com 로 접근하면 거부됨
<source lang='html5'>
<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>
{{인용문|
{{인용문|
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.
14번째 줄: 14번째 줄:
==해결방법==
==해결방법==
* https://raw.githack.com/ 에 가서 URL을 입력하면 CDN 주소로 바꿔줌
* https://raw.githack.com/ 에 가서 URL을 입력하면 CDN 주소로 바꿔줌
* 또는 아래와 같이 수동으로 URL을 바꿔도 사용 가능<ref>정확하게는... rawgit.com은 non-production판, cdn.rawgit.com은 production판</ref>
* 또는 아래와 같이 수동으로 URL을 바꿔도 사용 가능하나 이경우 업데이트가 제때 안될수 있음
:https://github.com/xdan/datetimepicker/blob/82a256409f0af54e4d1fd074b312fa579a122d38/jquery.datetimepicker.css
:https://github.com/xdan/datetimepicker/blob/master/jquery.datetimepicker.css
:→ https://rawcdn.githack.com/xdan/datetimepicker/82a256409f0af54e4d1fd074b312fa579a122d38/jquery.datetimepicker.css
:→ https://rawcdn.githack.com/xdan/datetimepicker/master/jquery.datetimepicker.css
* 브랜치가 아닌 특정 커밋, 태그 등 불변하는 것을 기준으로 링크를 만들어야 안전함


<source lang='html5'>
<syntaxhighlight lang='html5'>
<link rel="stylesheet" href="https://rawcdn.githack.com/xdan/datetimepicker/82a256409f0af54e4d1fd074b312fa579a122d38/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>
<script src="/https://rawcdn.githack.com/xdan/datetimepicker/82a256409f0af54e4d1fd074b312fa579a122d38/jquery.datetimepicker.js"></script>
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

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 }}