Help Me With Cookies, HTML and IE8

xarzu

New Member
Help Me With Cookies, HTML and IE8

For complex reasons, I have to use HTML with JavaScript to set a cookie. I know it is easy to set and get cookies PHP but I have to put the code in HTML.

I have searched the internet for some examples and I ran a test based on an example. I ran this Javascript code:
Code:
<SCRIPT LANGUAGE="JavaScript">

function putCookie()
{
	cookie_name = "specialcookiehuge";

 	if(document.cookie != document.cookie)
	{
		index = document.cookie.indexOf(cookie_name);
	}
	else
	{
		index = -1;
	}

	if (index == -1)
	{
		document.cookie=cookie_name+"; expires=Monday, 04-Apr-2020 05:00:00 GMT";
	}

}
</SCRIPT>

I tested this code by placing alert statements and I nkow that the line:
Code:
document.cookie=cookie_name+"; expires=Monday, 04-Apr-2020 05:00:00 GMT";
gets run.

I tried to find this cookie (Tools -> Internet Options -> Browsing History ->Settings) And I did not find anything named "specialcookiehuge" in "View Objects" or "View Files".

I guess I could try other browsers, but it would be good to know what I am doing wrong. I do not know if I am really setting a cookie. Is there some additional javascript command I am missing? Or, is the cookie being set but I am not looking in the right place according to the tutorials I saw online?
 
Top