Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/01/2014, 13:25
Igbar
 
Fecha de Ingreso: noviembre-2008
Mensajes: 25
Antigüedad: 16 años, 4 meses
Puntos: 0
Cambiar la ruta de una cookie

Hola, necesito hacer que el siguiente código que activa una cookie, en lugar de que coja la URL actual me coja una URL fija, por ejemplo www.miweb.com. Creo que tengo que añadir algo de path= pero no estoy seguro, gracias de antemano por vuestra ayuda.



function getCookie(c_name){
var c_value = document.cookie;
var c_start = c_value.indexOf(" " + c_name + "=");
if (c_start == -1){
c_start = c_value.indexOf(c_name + "=");
}
if (c_start == -1){
c_value = null;
}else{
c_start = c_value.indexOf("=", c_start) + 1;
var c_end = c_value.indexOf(";", c_start);
if (c_end == -1){
c_end = c_value.length;
}
c_value = unescape(c_value.substring(c_start,c_end));
}
return c_value;
}

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;
}

if(getCookie('todoenlaces')!="1"){
document.getElementById("barraaceptacion").style.d isplay="block";
}
function PonerCookie(){
setCookie('todoenlaces','1',180);
document.getElementById("barraaceptacion").style.d isplay="none";
}