A
Aki
Hi,
I have a problem with writing cookies in IE. The code works fine in
Netscape 7.2, Opera 8 and Firefox 1.04. In IE 6 the cookie isn't
written. I run WinXP SP2.
I'm trying to show a JavaScript alert reminding visitors about a
questionnaire on the site. I launch the alert in an onLoad-event, but
since I don't want to punish the visitors by showing the alert every
time they visit the page, I write a cookie when the alert-window is
closed. Before the alert is launched, I check if the cookie exists,
and the alert will be shown only if the cookie isn't found. This
should be rather simple.
Has anyone got an idea how to get this working?
I'm using the following code:
<html>
<head>
<script language=JavaScript>
function alertti(){
if (document.cookie !== "kysely=1") //never another cookie
alert("Have you noticed our questionnaire?");
document.cookie = "kysely=1; expires=01-Jan-06";
}
</script>
</head>
<body onLoad=alertti()>
</body>
</html>
Regards,
Aki
I have a problem with writing cookies in IE. The code works fine in
Netscape 7.2, Opera 8 and Firefox 1.04. In IE 6 the cookie isn't
written. I run WinXP SP2.
I'm trying to show a JavaScript alert reminding visitors about a
questionnaire on the site. I launch the alert in an onLoad-event, but
since I don't want to punish the visitors by showing the alert every
time they visit the page, I write a cookie when the alert-window is
closed. Before the alert is launched, I check if the cookie exists,
and the alert will be shown only if the cookie isn't found. This
should be rather simple.
Has anyone got an idea how to get this working?
I'm using the following code:
<html>
<head>
<script language=JavaScript>
function alertti(){
if (document.cookie !== "kysely=1") //never another cookie
alert("Have you noticed our questionnaire?");
document.cookie = "kysely=1; expires=01-Jan-06";
}
</script>
</head>
<body onLoad=alertti()>
</body>
</html>
Regards,
Aki