admin管理员组

文章数量:1277298

I would like not to dispaly the pop-up message below when post back occurs. My page has nothing to do with pricing it is displaying ms chart that updates on postback. How to disable in code or java script?

to display the webpage again internet explorer needs to resend the information you've previously submitted.

This is the javascript i've tried: doesn't work though.

<script type="text/javascript">
// <!--
function submitForm() {
    window.opener.document.forms[0].submit();
    }
// -->
</script>

and is attached the function to the form as so:

<body>
<form id="form1" runat="server" onsubmit="submitForm()">

I would like not to dispaly the pop-up message below when post back occurs. My page has nothing to do with pricing it is displaying ms chart that updates on postback. How to disable in code or java script?

to display the webpage again internet explorer needs to resend the information you've previously submitted.

This is the javascript i've tried: doesn't work though.

<script type="text/javascript">
// <!--
function submitForm() {
    window.opener.document.forms[0].submit();
    }
// -->
</script>

and is attached the function to the form as so:

<body>
<form id="form1" runat="server" onsubmit="submitForm()">
Share Improve this question asked Aug 11, 2011 at 17:03 Troy MitchelTroy Mitchel 1,81013 gold badges51 silver badges89 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 6

I'd bet you're doing this in your JavaScript:

FB.Event.subscribe('auth.login', function(response) {
    window.location.reload();
});
FB.Event.subscribe('auth.logout', function(response) {
    window.location.reload();
});

While the above code es from the Facebook documentation, and it works for a standalone website implementing the Facebook JavaScript SDK, it will break your Facebook App in Internet Explorer and Firefox by causing an infinite loop.

When Facebook loads an App, it sends information about the user's authentication state via POST. The SDK processes this data and authenticates the user.

By telling the JavaScript SDK to reload the page upon successful authentication, Firefox and Internet Explorer interpret this to mean they should send the POST data again, too. Your App receives the POST data again, re-authenticates the user, and reloads the page, causing the infinite loop.

Solution: don't use window.location.reload(). Instead you'll need to set window.location.href (or otherwise strip the POST data from the browser request).

For those less fluent in Javascript like I am, I'll expound a bit on what Aaron said. At least this is what I dug up after reading his post.

window.location.href = window.location.href;

this will replace the document.location.reload(); and works as advertised.

I ended up having to modify the window.location.href string because my page behaved differently depending on what page the user came from. So here's my plete method for posterity.

    function RefreshParentPage()
    {
        //document.location.reload();
        var redirectURL = window.location.href;

        if (window.location.href.indexOf("showpage=summary") > -1) {
            redirectURL = document.location.href.replace("showpage=summary", "showpage=events")
        }

        window.location.href = redirectURL;
    }

That means this page was obtained after doing a POST request. The best way to stop that is to redirect to the same page after having processed the POST request in your server code.

本文标签: