I have written a Jquery-Ui Dialog to popup as a confirmation on particular links. This however does not redirect to my Delete page correctly. However if I open the debugger in chrome to debug, then the code works as expected.

I have found the same question, however the solution does not seem to work for me. It is exactly the same scenario though. Question here [JavaScript redirect not working and works only in Chrome if debugger is turned on](https://stackoverflow.com/questions/17257119/javascript-redirect-not-working-and-works-only-in-chrome-if-debugger-is-turned-o)

So I have my link

```
<div id="confirm-dialog">
    <div class="dialog-inner">
        <p id="confirm-dialog-message"></p>
    </div>
</div>
<a href="/Customer/Delete/73865878346587" class="confirmLink" title="Delete Customer" data-confirm-message="Are you sure you want to delete this customer?">Delete</a>

```

And I have my javascript

```
    $('.confirmLink').click(function (e) {
    BodyScrolling(false);

    var theHref = $(this).attr("href");
    var theTitle = $(this).attr("title") == null ? "Confirm..." : $(this).attr("title");
    var theText = $(this).attr("data-confirm-message") == null ? "Are you sure?" : $(this).attr("data-confirm-message");

    $("#confirm-dialog-message").html(theText);
    $("#confirm-dialog").parent().css({ position: "fixed" }).end().dialog("open");
    $("#confirm-dialog").dialog({
        title: theTitle,
        close: function() {
            BodyScrolling(true);
        },
        buttons: [
        {
            text: "Yes",
            class: "mws-button red",
            click: function () {
                $("#confirm-dialog").dialog("close");
                window.location.href = theHref;
                return false;
            }
        },
        {
            text: "No",
            class: "mws-button black",
            click: function () {
                $("#confirm-dialog").dialog("close");
            }
        }]
    });
    return false;
});

```

So when I click my Delete link, I am indeed presented with my confirm dialog with Yes and No buttons, css styled correctly, and has captured the link href and bound it to the Yes button. If I click "No", I am kicked back and nothing further happens - Correct!

If I click Yes, it should take send me on to the original href that it captured. I have thrown alert(theHref) on the Yes Button click just before the redirect and it does show me the correct address (/Customer/Delete/73865878346587), but the redirect does not happen.

When I open the chrome debugger to debug the javascript or see if any errors occurred, then everything works as expected and redirects me correctly!

In IE, it does not work either.

I have tried...

```
window.location.href = theHref
window.location = theHref
location.href = theHref
$(location).attr('href', theHref)

```

I have also tried adding return false; after my redirect. Nothing works.

The link I added above to the same question said to make sure that the Yes button is being rendered on the page as a ... which mine is.

Can anyone shed any light?