我有一个网络应用程序,在首页上有一个登录表单。当提交登录表单时,一些JavaScript篡改会在幕后发生,用户的数据就会出现--而不会加载页面。
问题是,当用户从页面导航离开,然后使用“后退”按钮导航回来时,页面处于其原始的未登录状态。我可以让浏览器缓存修改后的DOM吗?
发布于 2011-04-29 17:53:18
您可以尝试使用像这样的插件:http://benalman.com/projects/jquery-bbq-plugin/
你必须在你的url中生成一个#logged链接,当你点击历史返回时,你只需要重新请求用户信息即可。
希望这能有所帮助。
发布于 2011-04-29 17:55:23
我大胆地猜测,与其将用户登录数据存储在客户端(这无论如何都不是一个好主意),不如做一些类似以下内容的事情:
- What I mean is: it's not REALLY logging the users in, it's just giving them the **illusion** of being logged in
- So you need to change it so that it stores some piece of information (probably in the session) that verifies that they are logged in.
- If they're not logged in, it still uses the old JS method to show the original, log them in, and update the DOM (the first time).
讲得通?
当前流量:
新流程:
https://stackoverflow.com/questions/5830475
复制相似问题