Get Set Cookies in Java Script

Cookies can be get via java script and an be set via java script.  you can get set cookies in javascript by method given below

         function setCookie(c_name, value, exdays) {
            var exdate = new Date();
            exdate.setDate(exdate.getDate() + exdays);
            var c_value = escape(value) + ((exdays == null) ? “” : “; expires=” + exdate.toUTCString());
            document.cookie = c_name + “=” + c_value;
        }




        function getCookie(c_name) {
            var i, x, y, ARRcookies = document.cookie.split(“;”);
            for (i = 0; i < ARRcookies.length; i++) {
                x = ARRcookies[i].substr(0, ARRcookies[i].indexOf(“=”));
                y = ARRcookies[i].substr(ARRcookies[i].indexOf(“=”) + 1);
                x = x.replace(/^\s+|\s+$/g, “”);
                if (x == c_name) {
                    return unescape(y);
                }
            }
        }

Javascript mailto function

If you want to send an email using client side script or link , you can easily do that , by your own custom subject and body message.

 function ShareCart() {

                    var email = prompt(“Enter the email of your friend to share your cart !”, “Alert”);

                    var subject = ‘Share Your Cart’;
                 
                    var message = ‘Your message goes here’             
               
                    var MailingLink = ‘mailto:’ + email + ‘?subject=’ + subject + ‘&body=’ + message;

                    window.open(MailingLink, “”, “”);
                              
                }