Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
How to check if cookies are enabled
Play lesson

JavaScript Tutorial - How to check if cookies are enabled

4.0 (0)
13 learners

What you'll learn

This course includes

  • 12.3 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

Link for all dot net and sql server video tutorial playlists http://www.youtube.com/user/kudvenkat/playlists Link for slides, code samples and text version of the video http://csharp-video-tutorials.blogspot.com/2015/02/how-to-check-if-cookies-are-enabled.html Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help. https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation=1 In this video we will discuss, how to check if cookies are enabled. Most websites rely on browser cookies being enabled. For example, if you have disabled cookies and if you try to log into gmail.com, you will receive an error message saying - Oops! Your browser seems to have cookies disabled. Make sure cookies are enabled or try opening a new browser window. The following JavaScript code detects if cookies are enabled. Most modern browser's support navigator.cookieEnabled property. This property returns true if cookies are enabled and false if cookies are disabled. Some old browsers don't support this property. For those browsers that don't support navigator.cookieEnabled property, we are setting "mytestcookie" and then reading again to make sure cookies are enabled. If we are not able to read "mytestcookie" then we know that cookies are disabled. [div id="msg"][/div] [script type="text/javascript"] function cookiesEnabled() { var cookiesEnabled = (navigator.cookieEnabled) ? true : false; if (typeof navigator.cookieEnabled == "undefined" && !cookiesEnabled) { document.cookie = "mytestcookie"; cookiesEnabled = (document.cookie.indexOf("mytestcookie") != -1) ? true : false; } return cookiesEnabled; } if (cookiesEnabled()) { document.getElementById("msg").innerHTML = "Cookies enabled"; } else { document.getElementById("msg").innerHTML = "Cookies disabled"; } [/script]

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere