Click here to Skip to main content
15,063,287 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
>Hi, i'm working in mvc4 web application we are using c#,jquery my task is to close the current tab on a button click i have tried with some jquery code it works well in IE but it does't work for Firefox and Chrome can any one help me how to close current tab using jquery?
    $('#submitCase').click(function () {                                                                                     
                $('#Messagesub').html("You are Closing Window");
                    modal: true,
                    resizable: false,
                    buttons: {
                        "Ok": function () {

function CloseWithWindowOpenTrick() {
        var objWindow =, "_self");
Updated 21-Mar-15 1:02am
Joan Magnet 21-Mar-15 13:15pm
Maybe this can help.

jQuery isn't magic or a new technology, it's just a javascript library, it can't do anything javascript can't. The reason closing the window doesn't work in various browsers is because browsers vary in the support they offer these non-standard features. In general browsers are moving away from supporting things that interfere with the user experience. If the user wants to close a tab at the clock of a button they'll click the "X" button on the tab. It is for the user to control their experience, not your code.
You can try; or window.close();

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900