Jump to content

[SOLVED] Open a new window in the previous window & closing the current window


playaz

Recommended Posts

Hi guys,

 

This is probably really simple but I am not sure how it is done.

 

Basically, I have a page (page 1) that has a standard text link that when the user clicks the link opens this in a new pop-up window (page 2) - in the new window when the user clicks a link it should close the pop-up and load this new URL in initial page (page 1).

 

So in simple terms, page 1 is always there, while page 2 closes itself when a link from within page 2 is clicked..

 

Any ideas or code on how I can achieve this?

 

Thanks in advance

Hi guys,

 

This is probably really simple but I am not sure how it is done.

 

Basically, I have a page (page 1) that has a standard text link that when the user clicks the link opens this in a new pop-up window (page 2) - in the new window when the user clicks a link it should close the pop-up and load this new URL in initial page (page 1).

 

So in simple terms, page 1 is always there, while page 2 closes itself when a link from within page 2 is clicked..

 

Any ideas or code on how I can achieve this?

 

Thanks in advance

page 1

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script>
function open_window()
{
window.open('2.html','pwindow','status=1');
}
</script>
</head>

<body>
<a href="javascript:open_window()">Open Popup</a>
</body>
</html>

 

page2

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script>
function open_window()
{
window.opener.document.location.href="http://www.google.com";
window.close();
}
</script>
</head>

<body>
<a href="javascript:open_window()">Open page in parent window</a>
</body>
</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.