I have been working on a cookie ...
When you go on my website for the first time it will ask you to select your profile. After doing so, it saves a cookie with the name of your profile inside it.
Everytime you go back to the page, it checks whether or not the cookie with your profile name exists or not, if it does it will take you to the main page, if it doesnt, it will take you to the profile selection page.
My cookie works fine for a couple of days. I can turn my computer off and on and when i go back to the website, it will always remember my name.
Until i delete my cookies ...
After a few days though, my cookie doesnt work anymore, it works if you swap webpages with your browser open. But as soon as i close my browser, it wont work!.
I have checked my expiry date on my cookie (which i have set to one year).
Im just wondering if any of you have had similar problems.
My website is
i dont know whether freewebs may have something to do with it?
Here is my cookie saving code by the way if it helps ...
I hope someone can help me in this strange problem ...
Thanks alot
- Jon
JavaScript Beginner at work
When you go on my website for the first time it will ask you to select your profile. After doing so, it saves a cookie with the name of your profile inside it.
Everytime you go back to the page, it checks whether or not the cookie with your profile name exists or not, if it does it will take you to the main page, if it doesnt, it will take you to the profile selection page.
My cookie works fine for a couple of days. I can turn my computer off and on and when i go back to the website, it will always remember my name.
Until i delete my cookies ...
After a few days though, my cookie doesnt work anymore, it works if you swap webpages with your browser open. But as soon as i close my browser, it wont work!.
I have checked my expiry date on my cookie (which i have set to one year).
Im just wondering if any of you have had similar problems.
My website is
i dont know whether freewebs may have something to do with it?
Here is my cookie saving code by the way if it helps ...
Code:
function confirmProfile() {
selectedNumber = document.getElementById("choosePlayer").selectedIndex
selectedPlayer = document.form1.choosePlayer.options[selectedNumber].name
expireTime = new Date(); // create a new blank date
oneYear = 1000*60*60*24*7*52 // 1000 milliseconds in a second. 1000 * 60 = 1min, *60 = 1hour, *24 = 1day * 53 = 1 year
alert(oneYear)
expireTime.setTime(expireTime.getTime() + oneYear); // set the time of blank date to the current date + 1day
expireTime.toGMTString(); // convert the time into G.M.T Time
// create the cookie using the following: - 1)name of cookie, 2)contents of cookie, 3)expiry date of cookie
document.cookie = selectedPlayer + ";" + "expires=" + expireTime + ";"
alert("Thank you, you will now be redirected to the main page" + document.cookie);
window.location="[URL unfurl="true"]http://www.freewebs.com/foxandhounds/index.html";[/URL]
}
I hope someone can help me in this strange problem ...
Thanks alot
- Jon
JavaScript Beginner at work