Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Redirect

  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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>

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    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
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yea i kno that, but i accept cookies, and i didnt clean out the cookie folder, and it still doesn't work 4 me.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •