how to open another window and close the window that calls it

Posted by user225269 on Stack Overflow See other posts from Stack Overflow or by user225269
Published on 2010-04-14T06:04:24Z Indexed on 2010/04/14 6:13 UTC
Read the original article Hit count: 227

Filed under:
|

I have this code in userpage.php:

<script langauge="JavaScript"><!--
function newWindow(fileName,windowName) { msgWindow=window.open(fileName,windowName); }
//--></script>

<a href="javascript:newWindow('1.html','window1')">Logout</a>

And this code at index.php:

<script language="JavaScript"><!--
function newWindow(fileName,windowName) { msgWindow=window.open(fileName,windowName); }
function replaceURL(fileName) { newWindow(fileName,'window2'); self.close(); }
//--></script>

What Im trying to do is to call another window that show index.php. Calling it with the userpage.php. But the script doesn't close the window that calls it.

Its a logout link. Because when I press back button after logging out. I end up seeing the page which only the user that has logged in can access

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about php