4 var imageLoadResult
= 'N/A';
5 var iframeLoadResult
= 'N/A';
7 function imageLoaded() {
8 var image
= document
.getElementById('blacklisted_image');
9 // Additional sanity check to make sure the image is indeed loaded.
10 // Not strictly needed.
11 if (image
.height
== 1 && image
.width
== 1) {
12 imageLoadResult
= "success";
14 imageLoadResult
= "error";
18 function imageError() {
19 imageLoadResult
= "error";
22 function iframeLoaded() {
23 // Unfortunately, iframe load errors generally don't result in onerror
24 // actually being called, so also check that the title is accessible.
25 // Since this is a same-site iframe, it generally should be, unless there's
26 // an error page showing in the iframe, in which case it's treated as a
27 // cross-domain iframe.
29 document
.getElementById('blacklisted_iframe').contentDocument
.title
;
30 iframeLoadResult
= "success";
32 iframeLoadResult
= "error";
36 function iframeError() {
37 iframeLoadResult
= "error";
41 <img id=
"blacklisted_image" src=
"pixel.png" onload=
"imageLoaded()" onerror=
"imageError()"></img>
42 <iframe id=
"blacklisted_iframe" src=
"blank.html" onload=
"iframeLoaded()" onerror=
"iframeError()"></iframe>