Hey

Im having problemas getting/setting cookies. On local side I can do it but only I cant....

I set a cookie at http://example.com/folder/index.html

and I cant read it at for example http://example.com/folder/otherfolder/file

This does NOT work:

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


            setCookie(nombrecorte+this.getParameterByName("idProd"),document.getElementById('nombrecorte').value,365);

This does WORK

            nombrecorte+this.getParameterByName("idProd")+'='+document.getElementById('nombrecorte').value+'; domain=.'+domain+'; expires='+dia.toGMTString()+'; path=/';   

But only like I said, local. Never online.

What could be the problem? Any more information needed?

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.