How does zendframework determine whether the browser is closed?
Source: Internet
Author: User
Um zendframework: how to determine whether the browser is closed
Function onbeforeunload_handler (){
Var n = window. event. screenX-window.screenLeft;
Var B = n> document.doc umentElement. scrollWidth-20;
Alert ('aaa ');
If (B & window. event. clientY <0 | window. event. altKey ){
Alert ('SSSS ');
}
This is a js solution. I used it and it is not easy to use. Occasionally, is it because I use IE9.
In the case of abnormal shutdown, such as power failure, how can we set the logout process 10 minutes later.
Thank you for your help.
------ Solution --------------------
Zend is a framework that only runs on the server. how can I know about the client? this problem has always been difficult to solve through many methods, because the http protocol is stateless, the server can check whether the user is valid only when the client actively accesses the server.
1. js event judgment
2. the logged-on session is written to the database, and the timed detection exceeds the specified time. no operation is defined as exited.
3. write the last time to access the database, and regularly clear the user access information that has not been updated for a certain period of time.
Http://topic.csdn.net/t/20030905/16/2228210.html
------ Solution --------------------
I personally feel that java and. net can be done, but php is very difficult, because it is nothing more than the mechanism of php.
Although both the server side and http have no connectivity, the browser's js is not so reliable.
However, both java and. net can be used as a process to regularly scan the server, that is, to process the process without a request. But php cannot. Zf is based on php, and naturally it cannot.
Of course, it can be implemented through memcache or simulated cache. Too troublesome. Not recommended.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service