• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 323
  • Last Modified:

Javascript - Close Popup page and reload main page at same time

Hi E's,
I have one page that open a pop-up page when I click in the link:
 
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>main page</title>
</head>

<body>
<a href="#" onClick="window.open('1007_2.php', 'edit', 'height=200,width=550,resizable=no,toolbar=no,menubar=no');return false;">edit</a></div>
</body>
</html>

Open in new window


...and I have the pop-up page that contain a link to close the pop-up window
 
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>popup page</title>
</head>
<body>
<a href="javascript:window.close();">close and reload main page</a>
</body>
</html>

Open in new window


The behavior is simple, main page open a pop-up and this pop-up have a button for close them self.

The question is, what changes I have to do in my code for when I click to close the pop-up, in the same time the main page reload.

Note the objective here is, in pop-up I will made some updates to data-base, and the main page will show that data has been change.

The best regards, JC
0
Pedro Chagas
Asked:
Pedro Chagas
  • 2
2 Solutions
 
nap0leonCommented:
change line 7 of your popup:

<a href="javascript:window.opener.location.reload(true);window.close();">close and reload main page</a>
main.html
popup.html
0
 
nap0leonCommented:
If you want the reload to work when the user clicks the "X" to close the popup...
try changing line 6 of the popup to:

<body onunload="window.opener.location.reload(true);">
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now