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
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
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
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!