<!DOCTYPE html>
<script>
  window.addEventListener("message", e => {
    var i = document.createElement('img');
    i.onload = () => { e.ports[0].postMessage("Load"); }
    i.onerror = () => { e.ports[0].postMessage("Error"); }
    if (e.data == "relative") {
      i.src = "/images/green.png";
    } else if (e.data == "same-origin-matching") {
      i.src = "http://user:pass@{{domains[www]}}:{{ports[http][0]}}/images/green.png";
    } else if (e.data == "cross-origin-matching") {
      i.src = "http://user:pass@{{domains[élève]}}:{{ports[http][0]}}/images/red.png";
    } else {
      i.src = "http://user:pass@{{domains[www]}}:{{ports[http][0]}}/images/red.png";
    }
  });

  (window.opener || window.parent).postMessage("Hi!", "*");
</script>
