Skip to content

Instantly share code, notes, and snippets.

@k33g
Created February 28, 2011 08:10
Show Gist options
  • Save k33g/847063 to your computer and use it in GitHub Desktop.
Save k33g/847063 to your computer and use it in GitHub Desktop.
Authentication-02
<html>
<head>
<title></title>
<script type="text/javascript">
window.addEventListener("message", handleFrameMessage, false);
function handleFrameMessage(e){
console.log(e);
}
function sendMessageToServer(){
document.getElementById("authentication").contentWindow.postMessage("HELLO","http://localhost:9000/authenticated");
}
</script>
</head>
<body>
<h1>Authentication</h1>
<hr>
<iframe id="authentication" style="width:100%; height:35%;" src="http://localhost:9000/authenticated"></iframe>
<hr>
<button onclick="sendMessageToServer();">Send Message</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment