4

I have Window 7- 64bit machine, I am using below Javascript code to check cookies enable in IE 11.

     var areCookiesEnabled= function () {
        //check by using navigator
        var cookieEnabledNavigator = (navigator.cookieEnabled) ? true : false;
        //By Setting Test Cookies
        document.cookie = "testcookie";
        var cookieEnabled = (document.cookie.indexOf("testcookie") != -1) ? true : false;
        return (cookieEnabled && cookieEnabledNavigator);
      }

It works when do below setting to disable cookies.

enter image description here

But it doesn't work with below setting to disable cookies.

enter image description here

enter image description here

  • Do I need to update cookies check code?
  • Does the IE 11 in Window 10 make any sense? Is Yes, Then why option is there for other Windows?

Any solution would be appreciated. Thanks

Janty
  • 1,708
  • 2
  • 15
  • 29
  • Duplicate still valid - yes you need debug your code for setting it and reading it again – mplungjan Sep 29 '16 at 12:14
  • I have debugged it, It sets and reads cookies when disable using advance option. Its duplicate in sense of cookies disable code but its for IE Advance cookies disable setting issue. In the link you have mark it as duplicate, there is no such conversation for advance setting in IE. Could you please review? – Janty Sep 29 '16 at 12:17
  • @mplungjan Can you please help me to update code as I have already checked for both Navigator and By explicitly setting and reading cookies? – Janty Sep 29 '16 at 12:24
  • 1
    I have reopened, but do not get your issue. Does this code work for you? `var cookies = ("cookie" in document && (document.cookie.length > 0 || (document.cookie = "test").indexOf.call(document.cookie, "test") > -1))` from http://stackoverflow.com/questions/6125330/javascript-navigator-cookieenabled-browser-compatibility – mplungjan Sep 29 '16 at 12:24
  • @mplungjan Thanks It would really help me to find issue. NO Its same thing, there is cookies I have seen as value for document.cookie . – Janty Sep 29 '16 at 12:25
  • So what is the bug, are cookies being saved or is the detection code not working? If the cookies are being written, than this is a super user issue. – epascarello Sep 29 '16 at 12:26
  • @epascarello, Cookies are being saved, but it should not be saved as I have already blocked using advance setting for First Party and Third Party cookies as above. The cookies detection code is setting the cookie and reading it. Is it any IE Advance Setting issue? – Janty Sep 29 '16 at 12:28
  • Are you sure you removed any previously existing cookies after you changed those settings? – CBroe Sep 29 '16 at 14:02

0 Answers0