Hi,
Just came up with a cool little "cookie check" bit of javascript :)
sessionCookieTest();
function testSessionCookie () {
document.cookie ="testSessionCookie=Enabled";
if (getCookieValue ("testSessionCookie")=="Enabled")
return true
else
return false;
}
function sessionCookieTest() {
if (testSessionCookie()) { } else { document.write('<h2>Cookie Warning!</h2><p>Your cookies seem to be disabled. <br> Logging in will not work until you enable cookies in your browser.') }
}
function getCookieValue (cookieName) {
var exp = new RegExp (escape(cookieName) + "=([^;]+)");
if (exp.test (document.cookie + ";")) {
exp.exec (document.cookie + ";");
return unescape(RegExp.$1);
}
else return false;
}
</script>
Simply place this code in login.html (anywhere you want, but recommended just above the <form ...> part of the template).
If someone doesn't have cookies enabled, then an error will be shown;
Simple as that
Hope that helps someone =)
Cheers
Andy (mod)
andy@ultranerds.co.uk
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Just came up with a cool little "cookie check" bit of javascript :)
Code:
<script> sessionCookieTest();
function testSessionCookie () {
document.cookie ="testSessionCookie=Enabled";
if (getCookieValue ("testSessionCookie")=="Enabled")
return true
else
return false;
}
function sessionCookieTest() {
if (testSessionCookie()) { } else { document.write('<h2>Cookie Warning!</h2><p>Your cookies seem to be disabled. <br> Logging in will not work until you enable cookies in your browser.') }
}
function getCookieValue (cookieName) {
var exp = new RegExp (escape(cookieName) + "=([^;]+)");
if (exp.test (document.cookie + ";")) {
exp.exec (document.cookie + ";");
return unescape(RegExp.$1);
}
else return false;
}
</script>
Simply place this code in login.html (anywhere you want, but recommended just above the <form ...> part of the template).
If someone doesn't have cookies enabled, then an error will be shown;
Quote:
<h2>Cookie Warning!</h2><p>Your cookies seem to be disabled. <br> Logging in will not work until you enable cookies in your browser.Simple as that
Hope that helps someone =)
Cheers
Andy (mod)
andy@ultranerds.co.uk
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates

