Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

No Cookie Redirect

Guest
Jun 14, 2010 Jun 14, 2010

Hi Chaps,

Quick question on this one, I've got a <noscript> tag in my HTML to check to see if Javascipt in enabled, but how do you check to see if cookies are enabled?
Is there HTML code / PHP function, or do you simply try to set a cookie and redirect on failure to read the cookie you just to to set?

Cheers

TOPICS
Server side applications
585
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Jun 16, 2010 Jun 16, 2010

Do it w/ php by setting a cookie at the beginning of the page then if/else where if cookie isset then show cookie page else show no cookie page.

http://www.w3schools.com/PHP/php_cookies.asp

Translate
Guest
Jun 16, 2010 Jun 16, 2010

Can be done with JavaScript:

<script type="text/javascript">
document.cookie = "Test=cookie";

if(document.cookie.indexOf("Test") == -1){
     alert("Disabled");
} else {
     alert("enabled");
}
</script>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 16, 2010 Jun 16, 2010
LATEST

Do it w/ php by setting a cookie at the beginning of the page then if/else where if cookie isset then show cookie page else show no cookie page.

http://www.w3schools.com/PHP/php_cookies.asp

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines