summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/support/iframe-that-opens-modals.html
blob: 50f56c6278a77e5ff80e5036c7d600d0b1fa4b91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!DOCTYPE html>
<script>
function openModal(name) {
    switch (name) {
    case "alert":
        return alert("MESSAGE");
    break;
    case "confirm":
        return confirm("MESSAGE?");
    break;
    case "prompt":
        return prompt("MESSAGE:", "DEFAULT VALUE");
    break;
    case "print":
        return print();
    break;
  }
}

onmessage = function(e) {
    parent.postMessage(openModal(e.data), "*");
}
</script>