站点选项卡重新加载
例如,如果我在浏览器中打开了 7 个带有用户个人资料的选项卡,则在会话关闭后,用户会看到警报确认,他是否不想继续他的会话,如果不继续,会话将销毁并带有他的个人资料的所有 7 个选项卡应该加载结束 php 将它们重定向到登录表单。
这是问题,我如何确定会话已被破坏,我们应该重新加载选项卡? Ajax 不是一个好的解决方案,因为它会向服务器发出大量查询
If I have for example 7 open tabs with user personal profile i browser, after session is going down user sees the alert confirmation does he wan't to continue his session or not, if not, session destroes and all 7 tabs with his personal profile should be loaded end php redirect them to login form.
here is the question, how can I determine that the session were destroed and we should reload tabs? Ajax is not good solution coz it's make a lot of queries to server
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为 AJAX 将是解决方案,无需进行大量查询。只需使用每 5 分钟执行一次的 JavaScript 回调函数,并检查用户是否选择不继续其会话。如果是,则重定向...
I think AJAX would be the solution, there's no need to make a lot of queries. Just use a javascript callback function which is executed once each 5 minuts and checks if user has chosen to not continue his session. If yes, then redirect...
如果您不想使用 AJAX(据我所知,这是唯一可用的动态刷新/关闭功能解决方案),则必须在每次加载页面时检查会话是否存在,以确定是否应重新加载或关闭页面。您可以通过将会话 ID 保存在 Cookie 中并在每次加载页面时进行比较来实现此目的。这将告诉您会话是否已结束,并且如果我没记错的话,可以允许您重新加载它。
If you do not wish to use AJAX, which is the only available solution I know of for dynamic refresh/closing capabilities, you will have to check if the session exists each time the page is loaded to determine if the page should be reloaded or closed. You can do this by saving the session id in a cookie and comparing it each time the page is loaded. This will tell you if the session has ended and can allow you to reload it if I recall correctly.