2017  Kodetalk | Feedback | Privacy Policy | Terms | About

What is the best way to implement "remember me" for a website at login time

Best way to implement remember me in a web application.

HTML5 if full of new and very useful features, which really makes web development quiet easier to a great extent. Its features helps to solve many complex problems and a better way to solve functionality which generally takes much time with older methods. One of the best feature in HTML5 is support for Web Storage. This has helped many of the developers in many different ways, for storing temporary data storage.One of the example is given below. Here is a simple example of “Remember Me” functionality on Login /Sign in form using HTML5 Web storage and jQuery.

                $('#remember_me').click(function() {
                    if ($('#remember_me').is(':checked')) {
                        // save username and password
                        localStorage.usrname = $('#username').val();
                        localStorage.pass = $('#pass').val();
                        localStorage.chkbx = $('#remember_me').val();
                    } else {
                        localStorage.usrname = '';
                        localStorage.pass = '';
                        localStorage.chkbx = '';

Html Code:

                <label class="checkbox">
                    <input type="checkbox" value="remember-me" id="remember_me"> Remember me

Answer is