使用#anchor的Response.Redirect在IE7中不起作用

问题描述 投票:0回答:3
Response.Redirect(string.Format("myprofile.aspx?uid={0}&result=saved#main",user.UserID));

所述代码转换为

IE7 - myprofile.aspx?uid=933fdf8e-1be0-4bc2-a269-ac0b01ba4755&result=saved

FF myprofile.aspx?uid=933fdf8e-1be0-4bc2-a269-ac0b01ba4755&result=saved#main

为什么IE7会掉我的锚?

编辑:我应该提到我与jQuery UI选项卡控件一起使用它。我希望将回发标签导入特定选项卡。

c# asp.net jquery-ui internet-explorer-7 jquery-ui-tabs
3个回答
1
投票

这将是非常黑客,但如果IE没有表现,你可以这样做。

通过一个参数,例如

uid=933fdf8e-1be0-4bc2-a269-ac0b01ba4755&result=saved&hash=main#main

然后在您的页面上(在正文关闭标记之前,或作为onload事件),仅针对IE,提取参数(如果存在)并手动设置哈希。

<!--[if IE]>
<script>
  if(document.location.href.indexOf('&hash=') != -1){
    //extract value from url...
    document.location.hash = extractedValue;
  }
</script>
<![endif]-->

1
投票

也许这是IE6的回归问题?

你有没有尝试使用working around it和&?


0
投票

我用RegisterClientScriptBlock发行window.location

像这样的东西:

string url = String.Format("{0}RegForm.aspx?regId={1}#A", this.CurrentFolderUrl, this.RegId);

Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "redirectToClientPage", String.Format("window.location='{0}'", url), true);
© www.soinside.com 2019 - 2024. All rights reserved.