Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在我的应用程序中编写了一些 javascript 代码,以防止特定类型用户的会话超时。超时由服务器控制。我该怎么做?
调用服务器以访问更新会话的某个页面。
function ping() { var img = new Image(); img.src = "somePage.php?ts=" + (new Date()).getTime(); window.setTimeout(ping,60*1000); }
您可以进行 Ajax 调用而不是图像请求。