如何在点击后退到最后访问过的页面的相同位置或点? [英] how to land on the same place or point of the last visited page on while clicking back?

查看:71
本文介绍了如何在点击后退到最后访问过的页面的相同位置或点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想知道当有人想要回到以前访问过的网页或网址时,他们在同一点或他做过的地方最后离开该页面或网址或标签菜单。或简单来说,如果一个表包含一百行,并且当访问者移动到下一页或标签时访问者位于第58行,并且在浏览器中单击返回时返回,那么我将如何让他在相同的行或点上他离开的地方?在同一会话中以及在新会话中。

Hi,

I want to know that when somebody wants to come back on the previously visited web pages or urls on the same point or a place where he did leave that page or url or a tab menu lastly. or in simple words, if a table contains hundred rows and the visitor was on 58th row when he moved to next page or tab, and while returning back by clicking back in browser then how would I get him on the same row or point or a place where he had left? In the same session as well as in a new session.

推荐答案

ViewState [PreviousPage] = Request.UrlReferrer; //在当前页面中存储上一页的URL

ViewState["PreviousPage"] = Request.UrlReferrer; // In Present Page Store the Url of previous page
Response.Redirect(ViewState["PreviousPage"].ToString());

//在当前页面按钮单击重定向到上一页

// In Present Page Button Click redirect to previous page


这实际上是一个非现实世界的要求。以用户的视角来思考。当你点击一个链接或者在访问和离开后返回页面时突然你到了一个你不打算去的位置,你会开始摸不着头脑那个应用程序出了什么问题? Web应用程序中没有任何地方(就我的知识而言)。现在,对于一个非现实世界的问题,一个没有现实世界的解决方案:

每当你离开页面时都使用JavaScript函数(onbeforeunload)并在cookie中保存正文滚动位置。现在每当你回到同一页面时,获取cookie并设置正文滚动。标签等也可以做同样的事情。一切顺利,希望有所帮助。
This is really a no-real-world requirement. Think as a user''s perspective. When you click on a link or come back on a page after visiting and leaving and suddenly you get to a position you did not intend to go to, you willl start scratching your head that what''s wrong with the application? Nowhere in the web applications it happens(in terms of my very little knowledge). Now for a very no-real-world problem a no-real-world solution:
Use JavaScript function whenever you leave a page(onbeforeunload) and save body scroll position in cookies. Now whenever you comeback to the same page get the cookie and set body scroll. Same thing can be done for tabs etc. All the best and hope it helps.


这篇关于如何在点击后退到最后访问过的页面的相同位置或点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆