Jump to content

Help me edit this javascript code please!

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
welton122

welton122

    Learning Programmer

  • Members
  • PipPipPip
  • 76 posts
hi all,

okay i got this code off of the internet:

<script language="JavaScript">

<!--

function refreshParent() {

  window.opener.location.href = window.opener.location.href;


  if (window.opener.progressWindow)

		

 {

    window.opener.progressWindow.close()

  }

  window.close();

}

//-->

</script>

Basically when a popup window is closed, it refreshes the parent window. This is done through a button, what i need to do is edit this code so that if they popup window is closed via a different method e.g. press the X at the top then it still refreshes the parent page as at the moment it will only refresh the parent page when the button is pressed.

Is this possible??

Many Thanks,
J

#2
gokuajmes

gokuajmes

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 518 posts
add this code to the 'Poped out' Window
< body onbeforeunload="alert('Closing');">