473,773 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cookies under 1 day does not work !

Hello,

after many deep searches on javascript and cookies, i still cannot have an
answer for a incredible cookie problem !
here it is, i hope you'll be able to answer me :

This is my function that put on a disk a cookie that has a 5 minutes
duration
function pose_5minutesco okie()
{
var expdate=new Date();
expdate.setTime (expdate.getTim e() + (5 * 60 * 1000));
alert ("expires=" + expdate);
document.cookie = 'test=1; expires=' + expdate.toGMTSt ring() + '; path=/;
domain=eg_domai n';
window.history. go(0);
}

the alert says that the expiration date is well calculated
the cookie sets on the drive

BUT

The cookie never expires !!!!!!!!

Another interesting expérience is that if i change the time to less than 500
(ms that's right !) instead of 5 minutes (in the example), the cookie does
not appear on the disk. I think this should mean that its living time is too
short to be written. I admit but if i run this cookie to expire in 1000 ms,
it appears ont the disk but it never expire !

Any idée ? Did anybody ran a 5 minutes cookie ?

Fabrice

Jul 20 '05 #1
2 1705
Fabrice Labrousse wrote:
Hello,

after many deep searches on javascript and cookies, i still cannot have an
answer for a incredible cookie problem !
here it is, i hope you'll be able to answer me :

This is my function that put on a disk a cookie that has a 5 minutes
duration
function pose_5minutesco okie()
{
var expdate=new Date();
expdate.setTime (expdate.getTim e() + (5 * 60 * 1000));
alert ("expires=" + expdate);
document.cookie = 'test=1; expires=' + expdate.toGMTSt ring() + ';
path=/;
domain=eg_domai n';
window.history. go(0);
}

the alert says that the expiration date is well calculated
the cookie sets on the drive

BUT

The cookie never expires !!!!!!!!

Another interesting exp�ience is that if i change the time to less than
500 (ms that's right !) instead of 5 minutes (in the example), the cookie
does not appear on the disk. I think this should mean that its living time
is too short to be written. I admit but if i run this cookie to expire in
1000 ms, it appears ont the disk but it never expire !

Any id� ? Did anybody ran a 5 minutes cookie ?

Fabrice


Hi Fabrice,

I am not sure, but maybe it is this:

It depends on what you mean by 'never expires'?
If you mean that the coockiefile exists on disk. --> okay. You cannot expect
your browser to scan every possible cookie from every possible site every
millisecond to check if it should delete them, can you?

If you mean that you try to read the value of test 10 minutes later the
normal way (that is not looking at the file, but reading it using
javascript), and it still shows up. --> your browser is broken, or you made
some mistake in the setting/getting of the cookie.
Maybe you are setting the cookie every time again (with a timestamp of +5
minutes from now)
Hard to tell without the complete code/logic.

I expect a browser to update the coockie (and delete it) only when needed.

Hope this helps,
regards,
Erwin Moller
Jul 20 '05 #2
Hello Erwin,

You were right, cookies are working fine. I was sure the cookie had to
disapear from the disk but it doesn't and anyway the cookie duration was ok.
Thank you very much for your help, i was stupidily stuck but you gave me the
idea i did not test.

Regards
Fabrice
"Erwin Moller"
<si************ *************** *************** @spamyourself.c om> a écrit dans
le message de news: 40************* ********@news.x s4all.nl...
Fabrice Labrousse wrote:
Hello,

after many deep searches on javascript and cookies, i still cannot have an answer for a incredible cookie problem !
here it is, i hope you'll be able to answer me :

This is my function that put on a disk a cookie that has a 5 minutes
duration
function pose_5minutesco okie()
{
var expdate=new Date();
expdate.setTime (expdate.getTim e() + (5 * 60 * 1000));
alert ("expires=" + expdate);
document.cookie = 'test=1; expires=' + expdate.toGMTSt ring() + ';
path=/;
domain=eg_domai n';
window.history. go(0);
}

the alert says that the expiration date is well calculated
the cookie sets on the drive

BUT

The cookie never expires !!!!!!!!

Another interesting exp?ience is that if i change the time to less than
500 (ms that's right !) instead of 5 minutes (in the example), the cookie does not appear on the disk. I think this should mean that its living time is too short to be written. I admit but if i run this cookie to expire in 1000 ms, it appears ont the disk but it never expire !

Any id? ? Did anybody ran a 5 minutes cookie ?

Fabrice
Hi Fabrice,

I am not sure, but maybe it is this:

It depends on what you mean by 'never expires'?
If you mean that the coockiefile exists on disk. --> okay. You cannot

expect your browser to scan every possible cookie from every possible site every
millisecond to check if it should delete them, can you?

If you mean that you try to read the value of test 10 minutes later the
normal way (that is not looking at the file, but reading it using
javascript), and it still shows up. --> your browser is broken, or you made some mistake in the setting/getting of the cookie.
Maybe you are setting the cookie every time again (with a timestamp of +5
minutes from now)
Hard to tell without the complete code/logic.

I expect a browser to update the coockie (and delete it) only when needed.

Hope this helps,
regards,
Erwin Moller

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3189
by: TG | last post by:
This is more of a pain than I thought it would be. I need a simple code segment to determine whether a browser accepts cookies or not. When I pass variables between pages when cookies are turned off, the global variables are empty between pages, fine, that tells me cookies store the global variables - right? I store the values in $_session and when cookies are turned on values are passed between web pages - I can see these values in fields...
2
4715
by: Tom | last post by:
Hi, I would like to use the standard PHP sessions and I understand they rely on the target web browser to support session cookies. I have tried the following code: <? session_start(); if (!session_id()) { //no support for session
20
3557
by: Brian Burgess | last post by:
Hi all, Anyone know if this is possible? If so, on which page would the cookie be? .. On the page calling a function defined in the include file? thanks in advance.. -BB
3
3855
by: Joey Powell | last post by:
This message was originally posted to the aspnet.security newsgroup, but no one there has ever heard of this before. That is why I am posting this message here, so that more people will see it... On my asp.net application, suddenly the forms authentication cookies for clients have quit expiring. This results in users being able to access the site from day to day without having to log in, even if their browers are closed and reopened...
2
387
by: Chris... | last post by:
I have an application that works just fine under normal conditions. But... When I run it through a "SSL Consentrator" (From Array Network), it starts to send me several (Request) cookies with the same name after the application has performed a "SignOut" - One with a "correct value" and one more that is blank. If I try to use/handle the "correct cookie" (Looping through the cookies), the application does not work properly, and if i try to...
10
1892
by: Stephan Schulz | last post by:
Hi all, I'm fairly new to JavaScript, and couldn't find a way to solve the following problem: I've written an application in DHTML/JavaScript, for one because I want to be able to offer access on the web, but primarily because it was the easiest way for me to combine GUI and layout in a portable manner.
0
1710
by: Claudio | last post by:
I have a demo app where cookies does not work. The first page create a cookies. The second read the contet. If I browse the pages via IE6.0 the pages does not work. If I browse the pages via FireFox the pages work fine. ************ SetCookies.asp <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
12
2672
by: Patxi | last post by:
This is the first time I try to use cookies, and despite of reading some tutotials, I'm have real trouble to make it work correctly. My cookie reading code is in Master Page. When I click on a test button (in a WEb User Control inside the aspx page), cookie value is displayed in Master Page but if I go to another page, no value is displayed... I need to be able tu use cookie's value across all the site... What am I doing wrong ? Code...
8
2765
by: Chuck Anderson | last post by:
I've instituted a sessions based scheme on my web site to combat hot linking to my images. When someone requests a page at my site, I set a session variable. I then use htaccess to redirect *all* image requests to a Php script that checks for that variable before simply delivering the image. Direct links to my images will fail this test and no image is served. I am monitoring my script by sending emails to myself and finding that...
2
5233
by: John Grandy | last post by:
Is anyone finding that cookies added to the Response.Cookies collection within pages which contain an UpdatePanel do not exist in the Request.Cookies collection when the page is posted back ? These should be complete page postbacks not partial postbacks, because the postback in question is not triggerred by a control inside the UpdatePanel (nor is it a trigger control for an UpdatePanel), but, not knowing all the details of how AJAX...
0
9621
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9914
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8937
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7463
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6717
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2852
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.