I need to close a popup window which has been loaded by a parent window.
This popup window is a Documentviewer window in my webapp.
I need to close this viewer by clicking a logout button which is in master page.
My code:
public string MySession //server side code
{
get
{
if (Session["RegID"] != null)
{
return Session["RegID"].ToString();
}
else
{
return "";
}
}
}
//client side code
$(window).load(function() {
Start();
});
function Start()
{
timedCount();
var t=setTimeout("Start()",10000);
}
function timedCount()
{
/*var out="<%=Session["RegID"]%>";*/
var out='<%=MySession%>';
if(out!="")
{
alert(out);
}else
{
window.close();
}
}
Server code is executed at very first time only.
My target is to close the popup if it is opened when user logs out.
You probably have something like this on your parent page:
If you change this to:
then at any time you can close it by coding:
http://jsfiddle.net/pimvdb/bjkNx/1/