Search code examples
javascriptsubmitload-balancingonload-event

submit infinite loop in window.onload


I have an issue that occasionally when a user opens the page it will seemingly flicker and resize itself. Look at the log it seems that the submit is being called multiple times, though i can't be 100% sure since i can't reproduce this in my own environment.

Is there anything in the below code that seems off to you, or anything that i could check to pinpoint the problem.

Edit: It seems that the .net page keeps serving up the page and the subsequent submit() is being called on the onload event, but it's never making it back to the server. We have this bug occuring on one machine but not another identical machine. I wonder if it could be a load balancer issue.

Edit: We have finally able to reproduce this bug. It is related to going through a load-balancer, but still don't know what the problem is. This problem also only seems to occur sometimes and if it does occur, if you close IE and reopen it, it has a chance of fixing itself.

window.onload = function () {
        if (document.getElementById("hfPostBack").value != "true") {
            if (confirm('hfPostBackは:' + document.getElementById("hfPostBack").value + 'です.続行します')) {
                document.getElementById("hfPostBack").value = "true";
                document.forms[0].submit();
            }
        } else {
            alert('hfPostBackは:' + document.getElementById("hfPostBack").value + 'です');
        }
    }

Solution

  • turns out that by changing the IIS security setting for the web app from anonymous logon to windows authentication fixed the problem.

    Still have no idea why this was happening, but it seems like it was related to the load-balancer passing authentication information/impersonation.