Check if Cookies are enabled

Ger Vang asked on July 7, 2014 10:50

Is there a way to check if cookies are enabled on a browser? If not, throw an error message back to the user. Right now, it's redirecting me to Kentico's "System error" page, which I don't want.

Correct Answer

Adam Gitin answered on July 7, 2014 14:52

You could populate your localized message into a js var and then use this var in the message. The message can be stored in ui culture string.

var msg = {$ ResourceStringKey $}

Adam @4Hilton

0 votesVote for this answer Unmark Correct answer

Recent Answers


Bill Tran answered on July 7, 2014 13:18

You can use javascript.

navigator.cookieEnabled

0 votesVote for this answer Mark as a Correct answer

Ger Vang answered on July 7, 2014 14:34

If I use JavaScript to show the message, how would I populate the message in the language the user select? Ajax call?

0 votesVote for this answer Mark as a Correct answer

Bill Tran answered on July 8, 2014 13:12

exactly what Adam said

0 votesVote for this answer Mark as a Correct answer

Bill Tran answered on July 8, 2014 13:13

Or you can use hidden input field, register client side script, ajax call, query string parameter, fire off a postback. Choice is yours.

0 votesVote for this answer Mark as a Correct answer

Ger Vang answered on July 9, 2014 15:34

Thank you! Adam's way works perfectly.

Am I able to use what Adam said but in an external JavaScript file? Seems like this will only work for "In-Line JavaScript" in the Web part.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.