我们有一个基于网络的产品,用Delphi和Intraweb编写,可以在公共信息亭(全屏)上运行。
有没有办法使用Intraweb显示不属于任何会话的登录页面(只是标准的Intraweb页面),所以会话只在用户成功登录时创建?
答案 0 :(得分:0)
我们发现这样做的最好方法是使用Javascript每隔30秒左右向Intraweb发出一个AJAX请求,以使Intraweb认为该页面仍在使用中,因此不会超时。< / p>
Javascript(每30秒调用一次Intraweb AJAX方法):
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function(event) {
window.setInterval(function() {
executeAjaxEvent("", null, "ResetSessionTimer", false, null, true);
}, 30000);
});
Delphi(私有方法并注册回调):
procedure TfrmLogin.ResetSessionTimer(EventParams: TStringList);
begin
//Intraweb does everything for us, we just need this method to exist
end;
WebApplication.RegisterCallBack('ResetSessionTimer', ResetSessionTimer);