SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
-
Oct 7, 2003, 02:32 #1
- Join Date
- May 2002
- Location
- Finland
- Posts
- 641
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Cookie value problem with IE - all other browsers ok
Veri irritating and difficult problem with cookies and IE (5 & 6), maybe someone could give a hint what's wrong. We have a frameset (navigation + banner + footer + main frame, basic stuff), and cookies are set on the main frame's <body OnUnload> event. When i click a link on the navigation the page on the main frame gets unloaded and cookie is set, and then i want to do stuff with that cookie on the next page.
Very simple, but problem is this: if I use IE i have to click the navigation link 2 times (= to load the new page twice) to make it work. And sometimes the values are not shown on the new page even though the cookie is always set properly. I have an alert box on the JS function which is driven correctly on onload and the values seem correct. Basically with IE this cookie stuff works without any sense and logic.
The js code:
There are other non-cookie related stuff in this function, but this is the row where cookies are set:
document.cookie="something=" + variable_x + ";expiration=" + get_expir() + ";path=/somefolder";
and
function get_expir() {
var aika = new Date();
// 365 * 24 * 60 * 60 * 1000ms = 31536000000ms
aika.setTime(aika.getTime() - 31536000000);
//i changed this to minus 3153... etc to test the expiration
return aika.toGMTString();
}
With Mozilla and Opera no problems, everything works perfectly. But with IE the problem I described. And of course deadline is closing fast... and I'm about to lose my mind.
-Z-
-
Oct 8, 2003, 03:09 #2
- Join Date
- May 2002
- Location
- Finland
- Posts
- 641
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Alright never mind, problem solved. Just in case someone else has the same problem one day:
I have a frameset like this:
Code:--------------------------------------------- | header --------------------------------------------- |menu | main --------------------------------------------- |bottom ---------------------------------------------
Code:<?php if(isset($_GET['foobar'])) { header("location:this_same_page.php"); exit; } ?>
-Z-Last edited by Zenith; Oct 8, 2003 at 05:46.
Bookmarks