Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Help Me With Cookies, HTML and IE8
Old 02-13-2011, 08:55 PM Help Me With Cookies, HTML and IE8
complete's Avatar
Novice Talker

Posts: 13
Trades: 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:
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?
complete is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-16-2011, 09:34 AM Re: Help Me With Cookies, HTML and IE8
Extreme Talker

Posts: 246
Trades: 0
"C:\Documents and Settings\USERNAME\Local Settings\Temporary Internet Files"

the cookies are listed as "cookie:USERNAME@URL"

you can also see if it is set by doing, alert(document.cookie)


http://www.w3schools.com/JS/js_cookies.asp
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
stbuchok is offline
Reply With Quote
View Public Profile
 
Old 02-21-2011, 04:32 AM Re: Help Me With Cookies, HTML and IE8
Novice Talker

Posts: 4
Trades: 0
Goto : http://www.w3resource.com/javascript...on-cookies.php
Setting Cookies
Create and Delete Cookies
Reading Cookies
A real example on Cookies
fesoe is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Help Me With Cookies, HTML and IE8
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11528 seconds with 12 queries