Hi
I am developing the asp.net using Vb.net code. I need to notify my client if client's browser is disabled the cookies, when the launch the asp.page.
Pls help me.
Maideen
Hi
I am developing the asp.net using Vb.net code. I need to notify my client if client's browser is disabled the cookies, when the launch the asp.page.
Pls help me.
Maideen
According to this MSDN article, you have to test by writing then reading the cookie. If you cannot read the cookie you wrote, you assume that cookies are turned off in the browser. Then, you can display a message to the user about the problem.
http://msdn.microsoft.com/en-us/library/ms178194.aspx
Read the section: Determining Whether a Browser Accepts Cookies
Try Javascript Navigator cookieEnabled Property:
http://www.w3schools.com/jsref/prop_nav_cookieenabled.asp
Apart from that refer this thread as well:
Thanks all of you. solved. below is the code
function CookieSetText()
{
var cookieEnabled=(navigator.cookieEnabled)? true : false
//if not IE4+ nor NS6+
if (typeof navigator.cookieEnabled == "undefined" && !cookieEnabled)
{
document.cookie="testcookie"
cookieEnabled=(document.cookie.indexOf("testcookie")!=-1)? true : false
}
if (cookieEnabled)
{
document.write("Cookies are enabled");
}
else
{
document.write("Cookies are not enabled");
}
}
window.onload = function () {
//calling the function on page load
CookieSetText();
};
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.