Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (28 sloc) 798 Bytes
<title>postMessage (cross domain)</title>
iframe {
width: 100%;
border: 2px solid #ccc;
<p><label for="message">Message</label><input type="text" name="message" value="my message" id="message" /> <input type="submit" />
<h2>Target iframe:</h2>
<iframe id="iframe" src=""></iframe>
var win = document.getElementById("iframe").contentWindow;
addEvent(document.querySelector('form'), 'submit', function (e) {
if (e.preventDefault)
// otherwise set the returnValue property of the original event to false (IE)
e.returnValue = false;
Jump to Line
Something went wrong with that request. Please try again.