Hi,
Can anyone shed any light on why this won't work? If the cookie doesn't exist, it works fine (i.e "null"), but if the cookie exists - but doesn't have a value - it won't work :/
I have a "developer" plugin in FireFox, which lets me view the cookies - it shows;
Name s
Value
Host mydomain.info
Path /
Secure No
Expires At End Of Session
Any ideas? :/
TIA
Andy
Can anyone shed any light on why this won't work? If the cookie doesn't exist, it works fine (i.e "null"), but if the cookie exists - but doesn't have a value - it won't work :/
Code:
<script type="text/javascript">
function Get_Cookie( name ) {
var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) )
{ return null; }
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ";", len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}
function cookiecheck() {
var cookietest = Get_Cookie('s');
if (cookietest == null || cookietest == "") { alert("foo") }
}
</script>
I have a "developer" plugin in FireFox, which lets me view the cookies - it shows;
Name s
Value
Host mydomain.info
Path /
Secure No
Expires At End Of Session
Any ideas? :/
TIA
Andy