Note that there are some explanatory texts on larger screens.

plurals
  1. POJavaScript Cookie returns null values in IE6 Only
    primarykey
    data
    text
    <p>I have a page where I grab a value from the query string and add it into a cookie. The value is used for a couple of different items on the page. If the user returns to the page and the value isn't in the query string, the value is pulled back from the cookie.</p> <p>I have tried doing my own cookie setting and retrieval in JavaScript as well as now using the jQuery Cookie plugin (<a href="http://plugins.jquery.com/project/Cookie" rel="nofollow noreferrer">http://plugins.jquery.com/project/Cookie</a>). Everything works flawlessly...except when I test it in IE6. IE7 and 8 are fine but IE6 always returns a null value for the items when I attempt to retrieve them from the cookie.</p> <p>I looked at the cookie information in Firefox and I'm not seeing anything beyond the 2 integer values that I set.</p> <p>Any ideas on what could be causing this in IE6?</p> <p>UPDATE: I took the test outside of my code into a basic html. Markup below. Same results where it returns null in IE6 (IETester).</p> <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt; &lt;head&gt; &lt;title&gt;Untitled Page&lt;/title&gt; &lt;script type="text/javascript" src="Scripts/jquery-1.3.2.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="Scripts/jquery.cookie.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { var testId = GetQueryStringValue("test"); if (testId == "") { testId = $.cookie("test"); alert(testId); } else { $.cookie("test", testId); alert("Test set"); } document.write(testId); }); function GetQueryStringValue(name) { var regex = new RegExp("[?&amp;]" + name + "(?:=([^&amp;]*))?","i"); var tmpURL = window.location.href; var results = regex.exec( tmpURL ); if (results == null) { return ""; } else { return results[1]; } } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload