[ jQuery ] 라이브러리 CDN 방식으로 연결하기

2022. 2. 22. 12:57jQuery

 

 

jQuery CDN

The integrity and crossorigin attributes are used for Subresource Integrity (SRI) checking. This allows browsers to ensure that resources hosted on third-party servers have not been tampered with. Use of SRI is recommended as a best-practice, whenever libr

releases.jquery.com

 

 


 

 

1) 홈페이지에 접속하여,  jQuery Core 클릭하기

 

 

 

 

 

 

 

2) minified ( 압축 파일 ) 선택

 

 

 

 

 

 

 

3) 코드 복사하기

 

 

 

4) 새로운 파일에 코드 붙여 넣어주기

 

 

 

< 코드 >

 

<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>CDN 연결 방법</title>
</head>
<body>
	<script src="https://code.jquery.com/jquery-3.6.0.min.js"
		integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
		crossorigin="anonymous"></script>
		
		<script type="text/javascript">
	
		// window.onload 이벤트와 같은 기능을 수행

		$(document).ready(console.log('jquery 라이브러리 연결 확인2')
				);
		
	</script>
		
</body>
</html>