Hello, I'm trying to make a popup, I've already set up its structure, I just need to validate it so that it does not open all the time I visit the page, I'm trying to use a cookie, I do not know if my code is conflicting with wp or is wrong.
<script>
function setCookie(name,exdays){ //função universal para criar cookie
var expires;
var date;
var value;
date = new Date(); // criando o COOKIE com a data atual
date.setTime(date.getTime()+(exdays*24*60*60*1000));
expires = date.toUTCString();
value = "TESTE123";
document.cookie = name+"="+value+"; expires="+expires+"; path=/";
}
function getCookie(){
var c_name = document.cookie; // listando o nome de todos os cookies
if(c_name!=undefined && c_name.length > 0){ // verificando se o mesmo existe
var posCookie = c_name.indexOf(cookieSeuNome); // checando se existe o cookieSeuNome
if (posCookie >= 0){ //se existir o cookie mostra um alert no browser
document.getElementById('Home_PopBg').style.display = 'none';
}else{}
}
}
</script>