WEB/html,CSS
[html][js] noscript / 자바스크립트 지원되지 않는 환경에서 표시되는 html
자바칩 프라푸치노
2021. 4. 8. 17:29
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script type="text/javascript" src="./js/main.js" defer></script>
</head>
<body>
안녕하세요!
<noscript>자바 스크립트를 지원하지 않는 환경입니다.</noscript>
</body>
</html>
|
cs |
index.html
body에 noscript로 문구를 적어두었습니다.
실행을 하면 지금은 자바 스크립트를 지원하는 환경이기에 noscript에 들어있는 내용이 출력되지 않습니다.
1
2
3
4
5
6
7
8
9
10
11
12
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<iframe src="./index.html" frameborder="0" style="border: 4px solid red;" sandbox=""></iframe>
</body>
</html>
|
cs |
noscript.html
이 파일에 iframe으로 index.html을 연결해주었습니다.
마지막에 sandbox가 있는데 샌드박스가 있으면 noscript에 적은 내용이 출력되고 , 없으면 출력되지 않습니다.
728x90