Created
September 1, 2012 07:15
-
-
Save stephennancekivell/3566315 to your computer and use it in GitHub Desktop.
controlling iframes with javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.0/jquery-1.8.0.min.js"></script> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
function doCall(){ | |
$.get('foo').error(function(){ | |
parent.afterCall(); | |
}); | |
} | |
</script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<script type="text/javascript"> | |
function afterCall(){ | |
console.log('afterCall'); | |
} | |
</script> | |
<iframe id="doCallFrame" src="./frame.html"></iframe> | |
<button onclick="document.getElementById('doCallFrame').contentWindow.doCall();">click me</button> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment