从asp.net内部的iframe重定向导致双后退按钮

时间:2013-03-06 15:21:57

标签: asp.net redirect iframe

好的,我明白标题不是非常清楚。我现在会更好地解释一下:

我的asp.net页面里面有一个iframe。要从iframe重定向父,请使用以下命令:

ClientScript.RegisterStartupScript(Me.GetType(), "redirector", "window.parent.location.href='myOtherPage.aspx'", True)

它的工作很好,在Internet Explorer和Chrome上非常完美,在firefox和opera上很糟糕。在这两个浏览器中,用户可以在父重新加载之前看到单个iframe重新加载,但那我要解决的问题。

重定向后,如果我点击浏览器上的“后退”按钮,我会返回旧页面并再次向前弹回。再次回击起作用(使用Chrome)。 使用Internet Explorer没问题,只需1回正常。 火狐和歌剧让我无休止地反弹!

我试图在执行后删除脚本,所以我使用了这个(没有任何换行符):

ClientScript.RegisterStartupScript(Me.GetType(), "redirector", 
    "<script id=""redirector"">
    document.getElementById('redirector').innerHTML = '';
    window.parent.location.href='myOtherPage.aspx';
    </script>", False)

但它没用。重定向仍然有效,但同样的两个后退按钮问题。

对此有什么想法吗?

0 个答案:

没有答案