gpt4 book ai didi

java - 防止用户在浏览器的多个选项卡/窗口中打开 JSF 页面

转载 作者:行者123 更新时间:2023-12-01 23:28:24 24 4
gpt4 key购买 nike

是否可以阻止用户在多个浏览器选项卡或窗口中打开 JSF 页面?

最佳答案

我同意接受的解决方案,但如果你仍然必须这样做,这些步骤对我有用(伪代码/伪python):

在 JS 方面:

if tabId not set:
. generate random number
. set property in sessionStorage
otherwise:
. get it from sessionStorage
make an ajax callback and send tabId
onError:
. alert();
. close current tab (if possible);
. logout

后端:(JSF):

Create custom filter:
if request contains the tabId info:
if it matches session's tabId: (being tabId not null)
sent response status code to an error such as forbidden
Optionally invalidate session
otherwise apply session filtering (do nothing)

关于java - 防止用户在浏览器的多个选项卡/窗口中打开 JSF 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3941603/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com