Aditya Chauhan

Aditya Chauhan

  • NA
  • 102
  • 57.4k

Not Able to close the browser tab?

Mar 20 2015 2:18 PM

on page load
StringBuilder sb = new StringBuilder();         sb.Append("<script type = 'text/javascript'>");         sb.Append("window.open('");         sb.Append(url);         Session["url"] = url.ToString();         sb.Append("');");         sb.Append("</script>");         ClientScript.RegisterStartupScript(this.GetType(),                 "script", sb.ToString());

after using this the tab is open 
but when i want to close the tab after 40 sec then my code is not working

//For closing
* I am also using timer for another work
string jScript = "<script>window.close();</script>";        ClientScript.RegisterClientScriptBlock(this.GetType(), "timer1_tick", jScript);


Answers (5)