<script  lang="Javascript">
    function quitBox(cmd) {
        if (cmd == 'quit') {
            open(location, '_self').close();
        return false;
<input type="button" name="Quit" id="Quit" value="Quit" onclick="return quitBox('quit');" />

I have the above code in a Visual Web part. I would like to close the window upon clicking the button. This code is working fine in IE but not in Chrome. How do I close a window with Chrome which is in a Visual Web Part?


You can't anymore because Chrome has become more tight on security a couple of months ago (self-redirection exploit)

and won't let a script close the window.


Has all the details

  • I am using the above mentioned script from the URL that you have mentioned unfortunately, it is working in Standard Web page but not in a Visual Web part page.
    – Ram
    Oct 5 '15 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.