Home  >  Q&A  >  body text

javascript - How to implement the principle of timeout and exit without operation after logging in to the website for a period of time, how to deal with it on the front end and the back end respectively?

How can I log out after logging in to the website for a period of time, for example, if there is no operation for 30 minutes?
What processing is required on the backend and frontend?

欧阳克欧阳克2692 days ago1288

reply all(2)I'll reply

  • 仅有的幸福

    仅有的幸福2017-06-28 09:25:39

    Front-end sends request

    The backend gets the request, clears the session, and then redirects directly,

    Or return the front-end response and let the front-end redirect


    The meaning of the question is ambiguous

    If the session takes effect during the operation and causes timeout redirection

    You can put some tags in the response header, delete them if they are expired, or change them

    In this way, when everything involves requests, you can find the effectiveness of the session and redirect the front end

    reply
    0
  • ringa_lee

    ringa_lee2017-06-28 09:25:39

    For the front end, if the login times out, there will be a return value after the timeout. You can operate based on the return value, log out of the login page, close the web page, etc.

    reply
    0
  • Cancelreply