Results 1 to 3 of 3

Thread: Cannot refresh parent window from popup when the page on parent window is changed.

  1. #1
    Join Date
    Nov 2005

    Cannot refresh parent window from popup when the page on parent window is changed.

    I have a multi-frame parent window. A popup is launched from one of the frames in parent window. The focus is set on the popup fine if I only click on the links on the frame that launchs the popup. However, if I click on the links in other frames, the popup will lose focus and then the parent window is loaded with other pages. In this case, "top.opener.document" in popup will cause Javascript error. Here is the code that I use "top.opener.document" to refresh parent window.

    function closepopup()
    //this "if" does not tell me the parent is changed or not
    if (top.opener && !top.opener.closed && top.opener.parent != null)
    var parentWindow = top.opener.document; //Cause Javascript error

    <input accesskey="c" onclick="closepopup()" type="button" value="Close">

    My question is how I identify the page on the parent window is changed or not.

    Any help is greatly appreciated!

  2. #2
    Join Date
    Nov 2005
    I figured out that I should use "onblur=focus()" instead of the following:

    function popupFocus() {
    if(winpop!=null && !winpop.closed) {

    "onblur=focus()" will block all the frames on the parent window so the parent
    window will not be changed when the popup has focus.

  3. #3
    Join Date
    Dec 2005


    Hello sophiez16

    Can you please explain how to use your function in a popup as i want to impliment it but I am a bit novice in javascript.

    thanks alot

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles