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
Post a Comment