473,508 Members | 2,046 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Set cookies in documents loaded from local filesystem

Is it possible to set a cookie in a HTML file which is loaded from the
local filesystem (protocol is 'file:' instead of 'http')?
It seems that I can set the cookie and I am also able to access it as
long as I do not close the browser. After I close the browser, the
cookie isn't there anymore.
I could not find it in the cookie file either.

Thanks for any help,
Thomas
Jul 20 '05 #1
2 2280
In article <23**************************@posting.google.com >,
th**********@deutsche-boerse.com enlightened us with...
Is it possible to set a cookie in a HTML file which is loaded from the
local filesystem (protocol is 'file:' instead of 'http')?
It seems that I can set the cookie and I am also able to access it as
long as I do not close the browser. After I close the browser, the
cookie isn't there anymore.
I could not find it in the cookie file either.


Sounds like you forgot to set an expires date, making it a session
cookie that goes away when you close the browser.

--
--
~kaeli~
Every calendar's days are numbered.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #2
Thomas Krebs wrote on 25 Nov 2003:
Is it possible to set a cookie in a HTML file which is loaded
from the local filesystem (protocol is 'file:' instead of
'http')? It seems that I can set the cookie and I am also able
to access it as long as I do not close the browser. After I
close the browser, the cookie isn't there anymore.
I could not find it in the cookie file either.


I've used local cookies in both of my browsers (Opera and IE) when
testing and they are stored.

It sounds like you didn't set the expiry date when you added the
cookie. If you set it manually (using document.cookie), make sure
that the date is *not* quoted, and is of the form:

Wdy, DD-Mon-YY HH:MM:SS GMT

For example: EXPIRES=Thu, 27-Nov-2003 14:30:00 GMT

The Netscape cookie standard (not RFC 2109) expected a two-digit
year, but I imagine all modern browsers will (and should) accept the
full four.

Most setCookie functions use a Date object set to the expiry date,
rather than a string.

Mike

--
Michael Winter
M.******@blueyonder.co.uk.invalid (remove ".invalid" to reply)
Jul 20 '05 #3

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

Similar topics

0
1260
by: Miguel | last post by:
Hello. I'm doing a login page in PHP and i'm with some problems with cookies: In a login.php, a cookie is set: ... setcookie("loggeduser","$username", time() + 900, "/"); header("Location:...
2
3491
by: kublai khan | last post by:
I am coming from (an elementary-level) javascript background. I set cookiesin select pages to see where the users are coming from and where they are going. It works quite nicely except that I'd...
3
4097
by: Alex Nitulescu | last post by:
Sorry, I'm really confused - I'm only at the middle of my book and already I can count 4 methods to store values. Yes, I know that cookies can not store much, but what is the difference between...
1
11414
by: Alex Nitulescu | last post by:
I have the following very simple colde (while learning about cookies and session state): Private Sub cmdAddCookie_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles...
10
1864
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...
5
10728
by: yawnmoth | last post by:
If running off of the local filesystem, in Firefox, or if the security settings are set appropriately, in Internet Exporer, XmlHttpRequests can be sent to any domain of your chosing. But what...
3
12689
by: mosesdinakaran | last post by:
Hi Where does the cookies stored in the client machine that php creates after calling session_start() function. I am using IE... I checked in the following folders but no cookies are stored....
2
2107
by: TuftyTrue | last post by:
Hi, On my site the user can browse to an image with <input type=file etc>. Althrough I have no problem swapping images with: document.getElementById('PictureToDisplay').src =...
2
1662
by: Eric | last post by:
Hello, I'm trying to debug a problem that some users of our ASP app see that goes away when they clear their cookies. I've gotten a copy of their cookie for our app and have renamed it from...
0
7388
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...
1
7049
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7499
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...
1
5055
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...
0
4709
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...
0
3199
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
767
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
422
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...

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.