javascript - how to remember user without registration -


i want users remembered on site don't have kind of signup. want user choose username when comes website first time , every other request user want remember username. tried this-

as user can't signup using facebook or email or else, not able find way remember user. so, mapped user's username ip address , saved database. so, subsequent requests ip address tell me 'which user is'. came know ip address can change when reset modem/connection. , static ip address have pay isp. then, quite sure of users have dynamic ip addresses.

so, there way this? know cookies , sessions don't think that's best way. may wrong. want know how big players in world tackle type of problem. or maybe, better solutions out there this? please give me directions.

added:

as based on answer, if on basis of cookies, won't delete user history when cookies removed browser? , if user login in same pc using different browsers, won't asked username multiple times?

don't rely on ip addresses. use infinite cookie. in jquery can set cookie expire follows (showing 20 years expiration - should enough!):

$.cookie('my_cookie', 'my_value', { expires: 365 * 20 }); 

if you're worried user clearing cookies, interesting approach ask email address (just email, no password). can email user link site access token appended url authenticates user - , store again in infinite cookie. way, have way of authenticating user without requiring formal sign up.

edit: reading question again looks you're trying remember user's account based solely on user tells username is. not secure approach , result in lost accounts. you're going need save on server, whether unique token, password, or email address.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -