blob: 9148be203d30ea043a56b38305877142735a4c49 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
<head>
<meta http-equiv="Content-Security-Policy" content="img-src 'none'">
</head>
<body>
<script>
var i = document.createElement('iframe');
i.srcdoc=`<script>
window.addEventListener('securitypolicyviolation', function(e) {
if (e.violatedDirective == 'img-src') {
top.postMessage('img blocked', '*');
}
})
</scr` + `ipt>
<img src='/content-security-policy/support/fail.png'
onload='top.postMessage("img loaded", "*")'/>`;
i.id = "srcdoc-frame";
document.body.appendChild(i);
</script>
</body>
|