-
Notifications
You must be signed in to change notification settings - Fork 6
/
webmessage.html
71 lines (65 loc) · 3.18 KB
/
webmessage.html
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html>
<head>
<title>Web messaging demo</title>
<style>
body {padding: 2px; background-color: rgb(255,255,204);font-family: Arial, Helvetica, sans-serif; font-weight: 500;border: 1px solid black; font-size: 16}
header {background-color:white; text-align:center; border-bottom: 1px solid black;}
h2 { display: inline; background-color:white; text-align:center;}
div.cds, div.reporting,div.ai {border-top: 1px solid black;}
label,button {padding: 2px; display: inline-block;width: 24.5%}
input,textarea,select {width: 65%;border:1px solid}
textarea {vertical-align: top;background-color:whitesmoke}
textarea.textAreaMonitor {width: 99%;font-family: "Segoe UI Emoji";}
</style>
</head>
<body>
<header><h2><span id="docTitle">EMR Client - HTML5 Web Messaging</span></h2></header>
</br>
<label>Receive Web Messages:</label>
<textarea id="receiveMessage"></textarea>
</br></br>
<div class="cds">
</br>
<button onclick="postMessage('https://cds-fhircast.azurewebsites.net','cds','iframecds')">Send Web Message to the iframe</button>
<textarea id="cds">Good afternoon from the EMR client</textarea>
<iframe id="iframecds" src="https://cds-fhircast.azurewebsites.net?webmessage=true" width="750" height="130" ></iframe>
</br></br>
</div>
<div class="reporting">
</br>
<button onclick="postMessage('https://reporting-fhircast.azurewebsites.net','Reporting','iframeReporting')">Send Web Message to the iframe</button>
<textarea id="Reporting">Good afternoon from the EMR client</textarea>
<iframe id="iframeReporting" src="https://reporting-fhircast.azurewebsites.net?webmessage=true" width="750" height="130" ></iframe>
</br></br>
</div>
<div class="ai">
</br>
<button onclick="launchAIClient()">Launch AI Client in another window</button>
</br>
<button onclick="postMessageAI('https://ai-fhircast.azurewebsites.net','ai')">Send Web Message to the other window</button>
<textarea id="ai">Hello from the EMR client</textarea>
</div>
<script>
var aiClient=null;
function launchAIClient(){
aiClient=window.open('https://ai-fhircast.azurewebsites.net?webmessage=true');
}
function postMessageAI(url,elementId){
var message= document.getElementById(elementId).value;
aiClient.postMessage(message,'*');
}
function postMessage(url,elementId,frameId){
var o = document.getElementById(frameId);
var message= document.getElementById(elementId).value;
o.contentWindow.postMessage(message, '*');
}
function receiver(event) {
// if (event.origin == 'http://example.net') {
document.getElementById('receiveMessage').value=event.data;
// }
}
window.addEventListener('message', receiver, false);
</script>
</body>
</html>