I need help with this and I've hadn't gotten any ansers but to use cookies. I'm a tatal noob so please don't get mad or say google 'cookies'. I want to make a javascript that will redirect users to a different site only once. The second time they would visit they would stay in the same page. Someone on mirc tald me that I should use cookies, and thats the only way out. It would make sence.., I've been google'in for 4 days!!!
So please be kind to share a code, or share a link to a website, or anything that would help me explain how to make my dream true. Thanks.
Cookies help
This should work:
Replace http://www.google.com with the url of the site were the visitor must be directed to the first time.
I only tested it in IE7 and Opera
| Code: |
|
<SCRIPT language="JavaScript"> var cookies = document.cookie; var pos = cookies.indexOf("visit="); function firsttime() { if (pos != -1) { var start = pos + 6; var end = cookies.indexOf(";", start); if (end == -1) end = cookies.length; var value = cookies.substring(start, end); if (value == "yes") return false; } return true; } if (firsttime()) { document.cookie = "visit=yes; max-age=" + (60*60*24*365); window.location.href="http://www.google.com"; } </SCRIPT> |
Replace http://www.google.com with the url of the site were the visitor must be directed to the first time.
I only tested it in IE7 and Opera
Thank You So Much!!!!
This was exactly what I was looking for! Your the best! 
