php - How to refresh parent page form a child page in javaScript -


i wondering if there way refresh parent page page originated from.

for example have parent.php page have javascript function opens child.php using javascript:

parent.php

  <input type="submit"  value="new page" onclick="createchild()" >    <script>   function createchild()    {        mywindow = open('child.php', '', 'menubar=no, width=450, height=550');   }   </script> 

in child page want have javascript function refresh parennt.php somehow not working.

child.php

   <script>    function refreshhome()    {       mywindow.window.location.href = mywindow.window.location;    }    </script> 

when click refresh home button nothing happens. know if it's possible , if yes doing wrong?

you can parent window object using window.opener or opener.

to refresh parent window, try following:

funcion refreshhome() {     opener.location.reload();         or      opener.location.href = opener.location.href; } 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -