I understand that when I send a cookie in a client-side page containing JS, it isn't actually "set"
until the next page is loaded. Is there some way to "set" it within the same html/JS page so it can
be accessed by other JS scripts in the same page?
Thanks,
Don
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =---- 9 1352
Don wrote on 13 feb 2005 in comp.lang.javascript : I understand that when I send
You mean "set" I hope?
a cookie in a client-side page containing JS, it isn't actually "set" until the next page is loaded. Is there some way to "set" it within the same html/JS page so it can be accessed by other JS scripts in the same page?
That would mean that if your first page is loaded and then you trip over
the power cable, disconnecting the pc, the cookie would not be set?
Seems very improbable to me.
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)
On 13 Feb 2005 14:17:11 GMT, "Evertjan." <ex**************@interxnl.net> wrote: Don wrote on 13 feb 2005 in comp.lang.javascript: I understand that when I send
You mean "set" I hope?
a cookie in a client-side page containing JS, it isn't actually "set" until the next page is loaded. Is there some way to "set" it within the same html/JS page so it can be accessed by other JS scripts in the same page?
That would mean that if your first page is loaded and then you trip over the power cable, disconnecting the pc, the cookie would not be set?
Seems very improbable to me.
My tests seem to verify what I've read, and that is that the browser doesn't actually "set" the
cookie until it encounters a subsequent page requiring its use. So, I suspose your theory that it
wouldn't be set it the pc lost power would be true.
Putting that aside, and assuming the foregoing is true, I'm looking for a way to force the browser
to set it in the same page containing the JS statement that attempts to set it.
Thanks,
Don
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Don wrote on 13 feb 2005 in comp.lang.javascript : That would mean that if your first page is loaded and then you trip over the power cable, disconnecting the pc, the cookie would not be set?
Seems very improbable to me. My tests seem to verify what I've read, and that is that the browser doesn't actually "set" the cookie until it encounters a subsequent page requiring its use.
How did you test that, Don?
So, I suspose your theory that it wouldn't be set it the pc lost power would be true.
Well I don't, offhand.
Putting that aside, and assuming the foregoing is true,
I would not assume that.
Please tell me what you mean by "set" in this case:
That the cooky file is placed in the IE temp structure?
What if that 'next page' is accessed a month later and the browser has
been closed down inbetween. Would you suggest that the cookie [one with
an expiry date, I mean, of course] is lost then?
That is contrary to my experience.
If it is not lost and not set,
where would the information be kept during that month?
I'm looking for a way to force the browser to set it in the same page containing the JS statement that attempts to set it.
Not possible in my opinion, follows your wrong assumption.
=======================
Let's test it, however:
<script type='text/javascript'>
document.cookie="myName=Evertjan"
alert(document.cookie)
</script>
It seems I am right, Don,
it returns the cookie string the first time.
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)
On 13 Feb 2005 15:05:49 GMT, "Evertjan." <ex**************@interxnl.net> wrote: Don wrote on 13 feb 2005 in comp.lang.javascript:
That would mean that if your first page is loaded and then you trip over the power cable, disconnecting the pc, the cookie would not be set?
Seems very improbable to me. My tests seem to verify what I've read, and that is that the browser doesn't actually "set" the cookie until it encounters a subsequent page requiring its use.
How did you test that, Don?
So, I suspose your theory that it wouldn't be set it the pc lost power would be true.
Well I don't, offhand.
Putting that aside, and assuming the foregoing is true,
I would not assume that. Please tell me what you mean by "set" in this case: That the cooky file is placed in the IE temp structure?
What if that 'next page' is accessed a month later and the browser has been closed down inbetween. Would you suggest that the cookie [one with an expiry date, I mean, of course] is lost then?
That is contrary to my experience.
If it is not lost and not set, where would the information be kept during that month?
I'm looking for a way to force the browser to set it in the same page containing the JS statement that attempts to set it.
Not possible in my opinion, follows your wrong assumption.
=======================
Let's test it, however:
<script type='text/javascript'>
document.cookie="myName=Evertjan"
alert(document.cookie)
</script>
It seems I am right, Don, it returns the cookie string the first time.
Evertjan,
You're right. I just realized in my script I use a function to extract cookies, and I didn't
extract again after making a change. So, it didn't look like my change had taken effect. Can't
believe I missed that one. I must have misinterperted the passage about a cookie not being set
until the following page is read. I think what they probably meant was that it isn't set until the
next reference (which apparently can be in the same page).
Thanks for your help.
Don
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Don said: You're right. I just realized in my script I use a function to extract cookies, and I didn't extract again after making a change. So, it didn't look like my change had taken effect. Can't believe I missed that one. I must have misinterperted the passage about a cookie not being set until the following page is read. I think what they probably meant was that it isn't set until the next reference (which apparently can be in the same page).
As far as the current page is concerned, the value is set immediately.
Your reference is probably saying that the server doesn't see the value until
the next time the page is requested.
On 13 Feb 2005 12:23:03 -0800, Lee <RE**************@cox.net> wrote: Don said:
You're right. I just realized in my script I use a function to extract cookies, and I didn't extract again after making a change. So, it didn't look like my change had taken effect. Can't believe I missed that one. I must have misinterperted the passage about a cookie not being set until the following page is read. I think what they probably meant was that it isn't set until the next reference (which apparently can be in the same page).
As far as the current page is concerned, the value is set immediately. Your reference is probably saying that the server doesn't see the value until the next time the page is requested.
Ok, that makes more sense to me. Thanks for your reply.
Don
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
JRS: In article <Xn********************@194.109.133.29>, dated Sun, 13
Feb 2005 14:17:11, seen in news:comp.lang.javascript, Evertjan.
<ex**************@interxnl.net> posted : Don wrote on 13 feb 2005 in comp.lang.javascript: I understand that when I send
You mean "set" I hope?
a cookie in a client-side page containing JS, it isn't actually "set" until the next page is loaded. Is there some way to "set" it within the same html/JS page so it can be accessed by other JS scripts in the same page?
That would mean that if your first page is loaded and then you trip over the power cable, disconnecting the pc, the cookie would not be set?
Seems very improbable to me.
ISTM quite possible that a browser reads the cookie file into memory
when it starts, uses the memory file for read/write, and saves the
cookie file when it is closed down. Other programs seem to work that
way with "status" information. One could test it by playing with
cookies in a two-browser system, or by viewing the cookie file by a non-
browser method, or by something like the method you imply (pressing the
reset button seems kinder).
Or that it only writes the cookie file on page change.
But I don't know whether it does either of those in this case.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk DOS 3.3, 6.20; Win98. ©
Web <URL:http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <URL:http://www.merlyn.demon.co.uk/programs/00index.htm>
My DOS <URL:http://www.merlyn.demon.co.uk/batfiles.htm> - also batprogs.htm.
Evertjan. wrote:
<--snip--> Let's test it, however:
<script type='text/javascript'>
document.cookie="myName=Evertjan"
alert(document.cookie)
</script>
That doesn't mean a cookie was set, it means either a cookie was set or
a property of document named cookie was set to myName=Evertjan. Test:
<script type='text/javascript'>
document.chicken="myName=Evertjan"
alert(document.chicken)
</script>
It seems I am right, Don,
I disagree.
it returns the cookie string the first time.
No, it returns a property of document named cookie. It doesn't mean a
cookie was actually written, stored, or saved.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Randy Webb wrote on 14 feb 2005 in comp.lang.javascript : No, it returns a property of document named cookie. It doesn't mean a cookie was actually written, stored, or saved.
That was why I repeatedly asked for a definition of "set".
Your above de facto definition of a cookie-with expiry date
is not my interpretation of "set" in the context of the OQ,
as all he wanted is to use the cookie content on the same page,
as I believe. Not in a dual browser setup.
That such cookies are not saved even if the browser is not closed when the
pc craches or looses power before that seems out of the question, but you
could proove that by testing in the way you suggested.
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: aa |
last post by:
Warning: mail(): Failed to connect to mailserver at "localhost" port 25,
verify your "SMTP" and "smtp_port" setting in php.ini
in php.ini I have:
SMTP = localhost
SMTP_PORT = 25...
|
by: Dayne |
last post by:
I know I can get the user's last input info with the win32 function
"GetLastInputInfo", but how do I set this value without any physical input
from the user? Any idea?
DT
|
by: AA Arens |
last post by:
When I place a record serch utility (vos the button placement wizzrd),
I discovered that the Match setting is "Whole Field" by default. How to
make "Any Part Of Field" default?
|
by: Torsten Sturm |
last post by:
Hello,
SP1 of Windows Server introduced a new "feature" in the GlobalizationConfig
class
called EnableBestFitResponseEncoding.
Effect is that when you set anything other than UTF8 in...
|
by: Ken Schutte |
last post by:
Lets say I want an integer class that lets you attach arbitrary
attributes. I can simply do:
class foo(int): pass
x = foo(5)
x.text = "okay"
print x, x.text # prints "5 okay"
So,...
|
by: laredotornado |
last post by:
Hi,
I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed
using Apache's apxs and the php library was installed to
/usr/local/php. However, when I set my "error_reporting"...
|
by: robert |
last post by:
Why can the default locale not be set by its true name? but only by '' ? :
PythonWin 2.5 (r25:51908, Sep 19 2006, 09:52:17) on win32.
(None, None)
Traceback (most recent call last):
File...
|
by: Kerem Gümrükcü |
last post by:
Hi All,
i am too tired now to find this out by my own, but why does
my while loop "while(readline==Console.ReadLine())" needs
twice return hit to read the line, after setting...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
| |