If you want to display a welcome message or alert box then you have to add the following JavaScript in your file.

function setCookie(key, value) {
            var expires = new Date();
            expires.setTime(expires.getTime() + (1 * 24 * 60 * 60 * 1000));
            document.cookie = key + '=' + value + ';expires=' + expires.toUTCString();
        }

function getCookie(key) {
           var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
           return keyValue ? keyValue[2] : null;
        }
if(getCookie('pop')==null)
{
	setCookie('pop',1);
	alert("WELCOME");
}

That’s it. In this code alert box shows only once per day.

Have any doubt, then comment here!

Leave a Reply

Your email address will not be published. Required fields are marked *