honest_critic's blog

By honest_critic, 4 months ago, In English

You all have noticed Last visit feature on profile page of every user. Me being a web developer is curious that how this feature is implemented on CF. As per my knowledge, CF website doesn't send background data to server while user is solving some problem.

Does this feature rely on the last time when user visited CF or reloaded any CF page?

I am thinking to implement same feature in one of my project but I doesn't want to use Ajax or any Asynchronous requests. That's why I am trying get idea regarding this feature's implementation.

MikeMirzayanov

 
 
 
 
  • Vote: I like it
  • +58
  • Vote: I do not like it

»
4 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I am not sure but I think it is only possible(as you have to fetch last time for any user from the database only) if you have a field at user database named last visit and update that on page reloads or mouse events.

»
4 months ago, # |
  Vote: I like it 0 Vote: I do not like it

For an easy but maybe not the best way:

Every time a request is made to the server which is authenticated(by logged-in user), you can just update the last visited field in DB for that user. You can do it by making a middleware or like a pro coder, copy paste some code at starting of every route