Hello Team i am just open a tab with java script in c#
//here
StringBuilder sb = new StringBuilder();
sb.Append("");
ClientScript.RegisterStartupScript(this.GetType(),
"script", sb.ToString());
//this is f9 perfactly ...
and i want to close the open tab(url) after 40 seconds
how it possible
i am using
string jScript = "";
ClientScript.RegisterClientScriptBlock(this.GetType(), "btnsubmit", jScript);
//this work with btnsubmit on any other form
but here is not working ..
i am just want to perform it with timer event or any other option you have please suggest..
Loading


Joginder BangerRank #360 · 7K reputationPosted Mar 26, 2015, 11:38 AM EDT
You can't close the current browser tab with javascript. It would be annoying for the user if sites start to close themselves like this without the user intent so browsers simply do not allow this. Don't forget that the notion of a browser tab is not defined anywhere in the HTML nor the EcmaScript specifications, some browsers don't even have tabs.
You could of course write a plugin that you will install on your client's browser that will do the job.
Aditya Chauhan121 reputationPosted Mar 27, 2015, 10:31 AM EDT
how it is work
string jScript = "";
ClientScript.RegisterClientScriptBlock(this.GetType(), "btnsubmit", jScript);