Here's what I suggest.
in the popup you should have:
<script type="text/javascript">
function reloadOpener() {
if (top.opener && !top.opener.closed) {
try {
opener.location.reload(1);
}
catch(e) {
}
window.close();
}
}
window.onunload=function() {
reloadOpener();
}
</script>
<form action="..." target="hiddenFrame">
</form>
<iframe style="width:10px; height:10px; display:none" name="hiddenFrame" src="about:blank"></iframe>
then in the server process you can return
<script>
top.close();
</script>
Old suggestions
There is no variable called popup in the popup window.
try
var popup = window.open('...','...');
if (popup) {
popup.onclose = function () { opener.location.reload(); }
}
or with a test:
popup.onclose = function () { if (opener && !opener.closed) opener.location.reload(); }
PS: onclose is not supported by all browsers
PPS: location.reload takes a boolean, add true if you want to not load from cache
as in opener.location.reload(1);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…