473,386 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

document.cookie on Opera and IE for Mac..

F
It seems that document.cookie doesn't work both on Internet
Explorer 5 for Mac (OS 9) and Opera 6 for PC... am I doing
something wrong? Or does it just not work? I don't get an
error message, the cookie just simply gets ignored. Do you
have any suggestions?

F@bio


Jul 20 '05 #1
3 3610
F@bio wrote on 03 Dec 2003:
It seems that document.cookie doesn't work both on Internet
Explorer 5 for Mac (OS 9) and Opera 6 for PC... am I doing
something wrong? Or does it just not work? I don't get an
error message, the cookie just simply gets ignored. Do you
have any suggestions?


Describe, "ignored". It doesn't appear in the cookie list, or
retrieving a value, in the same session, fails?

The most likely cause is that you aren't setting the expiry date.

Mike

--
Michael Winter
M.******@blueyonder.co.uk.invalid (remove ".invalid" to reply)
Jul 20 '05 #2
F
> Describe, "ignored". It doesn't appear in the cookie list,
or
retrieving a value, in the same session, fails?
....retrieving a value, in the same session, fails. Hope I'm
saying somthing stupid but I think the cookie doesn't get
written, it just stays in the memory.

Anyway, here I published an example:
http://globalmoments.firenze.net/cookie_e.htm

The most likely cause is that you aren't setting the

expiry date.

I'll try this way...

F@bio

Jul 20 '05 #3
F@bio wrote on 04 Dec 2003:
Anyway, here I published an example:
http://globalmoments.firenze.net/cookie_e.htm


I'd like to point out that that page works fine in Opera 7 (Win).

Your page (reformatted slightly):

You haven't included a DOCTYPE declaration. Before the HTML element,
you should include either this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

or this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

depending upon what elements and attributes you use. The latter is
preferable, but you'll probably need to change how you author pages.

<html>
<head>
<title>Cookie Test</title>
<script language="javascript">

The attribute, language, is deprecated and doesn't need to be used.
The type attribute, however, is /required/ and must be used. Change
that line (and the one later) to:

<script type="text/javascript">

function updateCookie() {

Neither of these two statements below have terminating semi-colons
(;). That could be part of your problem, but as I said, it worked
nevertheless.

document.cookie=document.myform.cookie.value

To access form elements, you should use the 'collection' syntax. It
works across more browsers:

document.cookie = document.forms['myform'].elements['cookie'].value;

Note the semi-colon, above.

location.reload(true)
}
</script>

You don't declare the default scripting language, which you /must/ do
if you use intrinsic events (onclick, etc). Add this:

<meta http-equiv="Content-Script-Type" content="text/javascript">

</head>

<body>
<script language="javascript">

Again, no type attribute (above) and no semi-colon (below).

document.write("Cookie value: "+document.cookie)
</script>
<form action="" name="myform">
<p>Definy the cookie value: <input type="text" size="60"
name="cookie"></p>
<input type="button" name="setCookie" value="Set Cookie"
onClick="updateCookie()">
</form>
<hr>
On Internet Explorer 5 for Mac (OS 9) and Opera 6 for PC doen't
seem to work!
</body>
</html>

Try these changes and test the page for yourself again: I can't - I
only have IE6 and Opera 7 (both Win), and it works in both of them.

Good luck,
Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk")
Jul 20 '05 #4

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

Similar topics

7
by: N.K | last post by:
Hi , Python's existing cookie module doesnt supports new cookie headers SetCookie2 , How to submit a patch for that ? I tried emailing person who owns that module.But no response. Thanks,...
6
by: Riko Wichmann | last post by:
dear all, i try to retrieve information from a secure web site. I use cookielib and urllib2 for this exercise which works to a certain level. I can authenticate myself and read the top-level...
4
by: Yvan J. Gagnon | last post by:
I am encountering a strange problem in Netscape 7 with a CFM file I am trying to troubleshoot (the page is working fine in NS Communicator and IE). Below is a sample of the problematic line of...
1
by: Vikram Bhatia | last post by:
In my web application we are able to store large data in the browser cookie keeping in mind the limit of 300 cookies per cookie file, 20 keys per cookie per domain and 4KB max size of each cookie....
3
by: InvisibleMan | last post by:
Thanks in Advance for any help on this - its truely sending my head in loops... so I appreciate your efforts! okay, I have a javascript listed below that drops down submenus contained within:...
4
by: Ziggy | last post by:
The purpose of my application is to require a website visitor to complete a form before participating in a search application. I have a specific reason for doing this with client-side javascript,...
4
by: Al Jones | last post by:
Well, hopefully that title get someones attention. In this old gwbasic program I've converted I *have* sucessuflly converted it to print to a file and the output is acceptable. From there I have...
6
by: Michi Henning | last post by:
I'm running the following code in Safari 2.0.4: document.cookie = 'MyCookie=1'; if(document.cookie == '') alert('document.cookie is empty!'); document.cookie always returns the empty string,...
12
by: Pankaj | last post by:
I have st a cookie that would last for 30 days. If I put a line <img src="http://www.example.com/readcookie.php" width="1" height="1"in a php file, I cannot read the cookie if I use IE7. However,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
0
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...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
Oralloy
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 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.