How to Close browser window on server side using SharePoint
Closing a browser window without the confirmation-prompt.
If you are closing a page using javascript in IE
window.close();
It will prompt an Microsoft Internet Explorer mesage
The Web page your are viewing is trying to close window to avoid/bypass this alert/message,
you need to assign the page you are close with
window.opener = "to some value";
this is because if you want to close a page directly the page should have a opener
thus by assigning the page with a opener value, the page can be close by calling
window.close() subsequently
Sample Code:
protected void Button1_Click(object sender, EventArgs e)
{
string script = "var windowObject = window.self; windowObject.opener = window.self; windowObject.close();";
Page.ClientScript.RegisterStartupScript(this.GetType(), "Close Window", script, true);
}
Popular tags: Sharepoint
Posted @ Tuesday, December 21, 2010 10:14 PM by Arun Kumar
Hi buddy... U did a great job.. Hats off to you.
Loading, please waiting...