First you test to see if cookies are enabled. If they are, you output a message. You can hide the message using CSS and then unhide after the test, but then the user will see it if they don't use CSS. You could have the element but with nothing inside, so that it won't display and then user innerHTML to enter the message after the test.
Assuming cookies have already been set (or attempted to be) use:
var cookieMessage = "You don't have cookies turned on!";
var cookieHTML = document.getElementById("cookiesOff");
function cookieMessage() {
if(document.cookie.length == 0) {
cookieHTML.innerHTML(cookieMessage);
}
}
And then have an HTML element like an h3
or p
with an id of cookiesOff
.