Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 27 lines (27 sloc) 0.624 kb
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
<!DOCTYPE html>
<html>
<head>
<title>postMessage target</title>
<style>
body {
  font: normal 16px/20px Helvetica, sans-serif;
  margin: 0;
  padding: 20px;
}
</style>
</head>
<body>
<strong>This iframe is located on the same domain</strong>
<p id="test">Send me a message!</p>
<script src="/js/h5utils.js"></script>
<script>
addEvent(window, "message", function(e){
  if ( e.origin !== "http://html5demos.com" ) {
    document.getElementById("test").innerHTML = 'Ignoring message from ' + e.origin;
  } else {
    document.getElementById("test").innerHTML = e.origin + " said: " + e.data;
  }
});
</script>
</body>
</html>
Something went wrong with that request. Please try again.