Skip to content

Instantly share code, notes, and snippets.

@kaku87
Created July 22, 2013 08:48
Show Gist options
  • Save kaku87/6052362 to your computer and use it in GitHub Desktop.
Save kaku87/6052362 to your computer and use it in GitHub Desktop.
javascript popup close callback event.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Popup Example</title>
</head>
<body>
<script>
function popupCallback(str){
alert("This is callback:" + str);
}
function openPopup(){
popname = window.open( "pop.htm", "popname", "status=1, height=200, width=200, toolbar=0,resizable=0");
popname.window.focus();
}
</script>
<a href="javascript:openPopup();">Click to open popup</a>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>query data</title>
<script type="text/javascript">
window.opener.popupCallback('pop some data'); //Call callback function
window.close(); // Close the current popup
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment