How to: Back button support “Ajax”

左心房为你撑大大i 提交于 2019-11-29 15:35:36

问题


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,


回答1:


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

Also check if this article helps




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/648250/how-to-back-button-support-ajax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!