hi,

i havent a clue about javascript just so you peeps know 😛

i've been trying to get a pop up to refresh the window it came from (opener) and then close when it's finished.

I thought i had got it from looking around google, but everytime i try this script i get this error

Line: 7
Char: 3
Error: 'window.opener.location' is null or not an object

here are my pages.

parent.html

<html>
<head>
  <title></title>
<script language="javascript">
function reloadIt() { 
  window.opener.location.reload(); 

  return true;
} 
function closeThis(){ 
  window.close() 
} 
function doIt() { 
  reloadIt();
  closeThis();
} 
</script>
</head>
<body>
<A onClick="javascript:win1=open('one.htm','title1','width=200,height=200');">click</a>
</body>
</html> 

one.htm

<html>
<head>
  <title></title>
</head>
<body>
<form>
  <input type="button" value="change2" onclick="opener.doIt();">
</form>
</body>
</html> 

could someone please point me in the right direction.

i'm using ie6 for windows xp.

thanks, Comms

    window.opener.location.replace(URL) works for me - but the reload doesn't...

    Try it that way...

      window.opener.location.refresh(); perhaps?

        i think whenever i try to use window.opener.* it stops working

        either way i got it working.....

        page1

        <script language="javascript">
        function reloadIt()
        {
        window.location = '<?=$_SERVER['REQUEST_URI'];?>'
        }
        
        function closeThis(){ 
          window.MyWindow.close() 
        } 
        function doIt() { 
          reloadIt();
          closeThis();
        } 
        
        </script>	
        

        page2

        <a href=\"javascript:opener.doIt();\">Click</a>
        

        nice n simple if u ask me 😛

          My usual way...
          opener.location='page.php';self.close();

            it seemed to me that whenever i tried to use opener. it produced errors

              Give it a shot...
              That's what I use on the popup pages that I want to refresh the parent windows.

                Originally posted by LordShryku
                Give it a shot...

                Originally posted by tuf-web.co.uk
                produced errors

                :p

                  I'm going to go with my usual explanation of the problem:

                  user error.

                  😃

                  [edit]Meant in jest. Got yanked out to a meeting while typing this, so forgot the smiley[/edit]

                    6 days later

                    Hi,
                    you are missing a "document"...
                    window.opener.document.location

                    bye

                    ... a very very slow answer... in my country it's used to say "After the fireworks" 🙂 😃

                      Write a Reply...