script태그는 클라이언트 측 스크립트(자바스크립트)를 작성하거나 외부 스크립트 파일을 연결할 때 사용한다.
<!DOCTYPE html>
<html>
<head>
<title>SCRIPT</title>
<script type="text/javascript">
alert("script");
</script>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
</body>
</html>
Attribute | Value | Description |
---|---|---|
async | async | 외부 파일 연결시 비동기 연결 설정 |
crossorigin | anonymous use-credentials |
Sets the mode of the request to an HTTP CORS Request |
defer | defer | 외부 파일 연결시 HTML문서의 파싱 후 실행 설정 |
integrity | filehash | 외부 파일의 무결성 체크 설정 |
nomodule | True False |
Specifies that the script should not be executed in browsers supporting ES2015 modules |
referrerpolicy | no-referrer no-referrer-when-downgrade origin origin-when-cross-origin same-origin strict-origin strict-origin-when-cross-origin unsafe-url |
Specifies which referrer information to send when fetching a script |
src | URL | Specifies the URL of an external script file |
type | scripttype | Specifies the media type of the script |

반응형