Monday, May 20, 2024
16
rated 0 times [  22] [ 6]  / answers: 1 / hits: 84281  / 13 Years ago, sat, november 12, 2011, 12:00:00

I have a very simple line of code that set and read a cookie. I kept getting empty value for my cookie and have no understanding why. I have cookie enabled and know that cookies work on the browser.



<HTML>
<HEAD>
<TITLE>Hello World</TITLE>
</HEAD>
<BODY>
<SCRIPT type=text/javascript>
document.cookie = ding=dong;
</SCRIPT>
<script type=text/javascript>
alert(document.cookie);
</script>
</BODY>
</HTML>

More From » google-chrome

 Answers
185

Recently I stumbled upon a similar issue. My script couldn't store a cookie in Chromium, although it worked well on all other major browsers. After some googling it turned out that Chrome ignores cookies from local pages. After I uploaded the page to remote server code magically started to work.


[#89162] Friday, November 11, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
gilbertomaximilianod

Total Points: 208
Total Questions: 96
Total Answers: 111

Location: Northern Mariana Islands
Member since Wed, Feb 24, 2021
3 Years ago
;