Window.close() not working within the frame

Hi,

After clicking the logout button i planned to close the window. But if i click on the button no action is taking place. PLease anyone help me out...

Thanks & Regards,

Satish R

[208 byte] By [ss1_ss1a] at [2007-11-27 10:47:51]
# 1

Post the code . That way it will b easy for others to correct it.

R@njita at 2007-7-28 22:22:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Ranjit,

Please find the code below.

<A href="#" onclick="javascript:window.close()" > <%= bean.findLabel("SP_Logout") %></A>

I tried by calling method(where includes window.close() command) when user clicks on the link. It's also not working.

<script language="JavaScript">

function do_logout()

{

window.close();

}

</script>

<A href="#" onclick="javascript:do_logout()" > <%= bean.findLabel("SP_Logout") %></A>

Regards,

satish R

ss1_ss1a at 2007-7-28 22:22:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

If you are using IE then the script

<A onclick="javascript:window.close()" >

<%= bean.findLabel("SP_Logout") %></A>

works perfect.

Incase you are using FireFox then check out this link

http://www.interwebby.com/blog/2006/02/04/3/

http://snipplr.com/view/1461/close-window-in-firefox-and-internet-explorer/

HTH

Adding one more link - R@njit

R@njita at 2007-7-28 22:22:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

Ranjith,

I tried both the solutions in both IE as well as fireFox but it is not working. Please let me know if you have any other solution.

The code that you have sent href is required

<A onclick="javascript:window.close()" ><%= bean.findLabel("SP_Logout") %></A>otherwise the link will not display.

Thanks & Regards,

Satish R

ss1_ss1a at 2007-7-28 22:22:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

Check the link below:

http://www.boutell.com/newfaq/creating/closebrowserwindow.html

When You Have Multiple Frames

Some readers have asked how to close the main window from a frame. As before, you can only do this if the main window was created by JavaScript code.

As long as that's the case, though, you can do it like this:

<script>

function closeTop()

{

var top = window.open("", "_top");

top.close();

}

</script>

<a href="javascript:closeTop()">Close This Entire Window</a>

The special window name _top always refers to the outermost parent window, even if you are deep inside a nested frame.

I won't forget your name because i have a good friend with the name of your's. Thanks Ranjit for your reply.

Regards,

Satish R

ss1_ss1a at 2007-7-28 22:22:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

Hi,

Can anyone has the soltion for closing the window for FireFox2.0 onwards...

Regards,

Satish R

ss1_ss1a at 2007-7-28 22:22:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...