You must Sign In to post a response.
  • Category: ASP.NET

    Close current tab in button click in asp.net c#

    Hi,

    I want to close current tab in button click in asp.net c#. Here is my code,

    <script type="text/javascript">
    function down() {
    window.top.close()
    }
    </script>

    its working in chrome. But not working in mozilla firefox. Please help me!!!
  • #762961
    Hello Sudha,

    Try this code :

    string jScript = "<script>window.close();</script>";
    System.Web.UI.ClientScript.RegisterClientScriptBlock(this.GetType(), "keyClientBlock", jScript);


    I have used it in one of my project. Hope this will help you.

    Regards,
    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

  • #762985
    Hi,

    You may have to handle this separately.

    Please refer below article:
    http://csharpdotnetfreak.blogspot.com/2008/11/javascript-windowclose-does-not-work-in.html


    Regards,
    Asheej T K
    Microsoft MVP[ASP.NET/IIS]
    DotNetSpider MVM


Sign In to post your comments