...

View Full Version : Redirect



Biggie
03-18-2005, 06:19 AM
Hey,

I just fixed up my website (www.BIGGIEmusic.tk :D ) and I need someone to help me. I wanted to make it so that if it's your first time viewing the website, it will bring you to the flash intro, but if you've been there before it will bring you to the home page. I tried using the code below, and it didn't seem to work very well. It might be because I am using the .tk thing (www.dot.tk). I'm not really sure. Can someone help me?


<HTML>
<head>
<title>BIGGIEmusic.tk</title>
</head>

<body bgcolor="#000000" text="#FF0000" link="#990000" vlink="#990000" alink="#990000">
<SCRIPT language=JavaScript>
<!--
function first() {
window.location = "first.html";
}
function frequent() {
window.location = "main.html";
}
function newCookie(name,value) {document.cookie = name+"="+value;}
function getCookie(name) {
var found=false,start=0,end=0,cookieString=document.cookie;
var i=0;
while (i<=cookieString.length) {
start=i;
end = start+name.length;
if(cookieString.substring(start,end)==name) {
found=true;
break;
}
i++
}
if (found) {
start=end+1;
end=document.cookie.indexOf(";",start);
if (end<start)
end=document.cookie.length;
return document.cookie.substring(start,end);
}
return "";
}
function tomain() {
var redirecting=getCookie("visited");
if (redirecting=='true') {
frequent();
} else {
first();
}
newCookie('visited','true');
}
// -->
</SCRIPT>

<BODY onload="tomain();">
</body>
</html>

Kor
03-18-2005, 10:32 AM
user may or may not accept the cookies, so that if the browser is set to refuse (some) cookies, the code will have no effect, as there is no cookie in the cache. The same if the user accept cokkies but it has cleaned the Temporary file.

Biggie
03-18-2005, 06:09 PM
yea i kno that, but i accept cookies, and i didnt clean out the cookie folder, and it still doesn't work 4 me.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum