homepage Welcome to WebmasterWorld Guest from 54.197.215.146
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Help Me With Cookies, HTML and IE8
Help Me With Cookies, HTML and IE8
complete




msg:4266715
 8:10 am on Feb 14, 2011 (gmt 0)

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:

<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:
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?

 

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved