-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcsp.html
More file actions
30 lines (21 loc) · 677 Bytes
/
csp.html
File metadata and controls
30 lines (21 loc) · 677 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSP example</title>
<meta http-equiv="content-security-policy" content="
script-src 'self' 'nonce-ZWhkS0drNGxpa3M7eGh3MGtlO3Rbd2tzaHdpM21mO0o=';
style-src 'self';
">
</head>
<body>
<input type="button" id="btn1" value="Button 1 (Inline JS)" onclick="alert('Button 1 clicked')">
<input type="button" id="btn2" value="Button 2 (Script tag JS)">
<input type="button" id="btn3" value="Button 3 (JS file)">
<script nonce="ZWhkS0drNGxpa3M7eGh3MGtlO3Rbd2tzaHdpM21mO0o=">
document.getElementById("btn2").onclick = function(e){
alert('Button 2 clicked');
}
</script>
<script src="csp-script.js"></script>
</body>
</html>