Skip to content

Instantly share code, notes, and snippets.

@ohidurbappy
Forked from kaku87/parent.html
Created December 25, 2022 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ohidurbappy/eb17b98a225e554d119a30cf523432cd to your computer and use it in GitHub Desktop.
Save ohidurbappy/eb17b98a225e554d119a30cf523432cd 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