Log in

View Full Version : Some Help with Cookies



Anon
05-23-2008, 06:08 PM
Hello there.

I am refurnishing my website and I have everything in a frameset document. The problem with this is that when someone hits the "refresh" button, the frameset reverts to its default page. This is quite an inconvenience, and is actually rather annoying. So my question is how can I set up a cookie that makes it so my website doesn't revert on refresh.

But alas, that would be too easy. See, with a cookie like that, every time you visited my site, it would automatically got to the page you were last at. And when you're visiting a site, you don't want that! You want the homepage!

I am sure that this is actually not that hard of a challenge, but I am quite a novice when it comes to scripting and was wondering if you guys could help me out.

Thanks in advance!
-Anon

magicyte
06-25-2008, 02:31 AM
This is possible to even do without cookies! In the <body> tag itself of the pages you want to stay at and not revert to the original state, input the following event handler: onbeforeunload="window.location.href='(this_document's_name).html'". This should take care of everything. Although you would need to replace "(this_document's_name)" with the actual document name. I really do hope this helps with everything.

-magicyte


-------------------------------
"Don't judge a program by its appearance,
but by its code."
-Magicyte

[http://magicyte.freehostia.com/ (http://magicyte.freehostia.com)]