如何:后退按钮支持“Ajax”

发布于 2024-07-14 21:38:37 字数 244 浏览 6 评论 0原文

我有一个asp.net ajax网站,它充满了在同一页面上发生的事情,无需重新加载页面,例如排序记录,分页,... 当用户转到同一站点中的另一个页面并按浏览器后退按钮时,如何使浏览器保存页面状态以使用预选选项(例如排序选项、分页中的页码)返回到该页面。

我知道新的 .net 3.5 中有一个历史记录控件,但它在同一页面中工作,而不是在从一个页面导航到另一个页面时工作。 我也在寻找一种适用于所有浏览器的解决方案。

谢谢,

I have an asp.net ajax website, it full of things happen on the same page without page reload, such as sorting records, paging,...
When the user go to another page in the same site and press the browser back button, how can i make the browser save the page state to return to it with the preselected options such as sorting option, page number in the paging.

I knew that there is a history control in the new .net 3.5 but its working in the same page not while navigating from a page to another.
Also i am looking for a solution which work in all browsers.

Thanks,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

心作怪 2024-07-21 21:38:37

您不需要 3.5 的历史记录控件, 在这里检查 ScottGu 的博客

另外检查是否 这篇文章有帮助

You dont need 3.5 for the history control, check ScottGu's blog here

Also check if this article helps

才能让你更想念 2024-07-21 21:38:37

您执行上面建议的历史插件的操作。 我假设在幕后,这就是正在发生的事情。 例如,当您的异步回发返回到客户端时,对 window.location = 'somePage.aspx#anchor1' (一个老式的 HTML 锚点)执行 JavaScript 调用,然后返回到客户端后的下一个异步回发将do window.location = 'somePage.aspx#anchor2' 等。GMail 在重定向到您的收件箱或电子邮件中的其他标签或文件夹时会执行此操作。

希望有帮助,
缺口

You do what the history plugin suggested above does. I'm assuming under the hood, this is what is going on. When your async-postback comes back to the client side for example, do a JavaScript call to window.location = 'somePage.aspx#anchor1' (an old school HTML anchor), then the next async-postback once back on the client would do window.location = 'somePage.aspx#anchor2', etc. GMail does this when it redirects to your inbox or other labels or folders in your e-mail.

Hope that helps,
Nick

鹿港小镇 2024-07-21 21:38:37

我听说这通常可以通过使用 iframe 而不是 XMLHttpRequest 来解决。 我不知道如何将此建议合并到 ASP.Net Web 应用程序中。

I've heard that this is usually solved by using an iframe instead of XMLHttpRequest. I don't know how to incorporate this advice in an ASP.Net webapp.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文