Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-18-2005, 06:19 AM   PM User | #1
Biggie
New to the CF scene

 
Join Date: Mar 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Biggie is an unknown quantity at this point
Unhappy Redirect

Hey,

I just fixed up my website (www.BIGGIEmusic.tk ) 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?

Code:
 <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>
Biggie is offline   Reply With Quote
Old 03-18-2005, 10:32 AM   PM User | #2
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
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.
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Old 03-18-2005, 06:09 PM   PM User | #3
Biggie
New to the CF scene

 
Join Date: Mar 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Biggie is an unknown quantity at this point
yea i kno that, but i accept cookies, and i didnt clean out the cookie folder, and it still doesn't work 4 me.
Biggie is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:51 AM.


Advertisement
Log in to turn off these ads.