SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Location
    South Africa
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Page redirection

    I would like redirect my visitors to my welcome page for just a few seconds before going on to my index page. Any ideas.

  2. #2
    SitePoint Enthusiast
    Join Date
    May 2001
    Location
    London
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should be able do this in HTML:

    <HEAD>
    <TITLE>Welcome</TITLE>
    <META http-equiv="Refresh" content="10; URL="http://www.yourindexpage.com">
    </HEAD>
    </BODY>

    This tells the page to refresh after 10 seconds (content="10 and then tells the browser which page to go to afterwards.

    Jo

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Location
    South Africa
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy tried it

    I've tried that but it keeps refreshing the same page, without going on to the specified page.

  4. #4
    Alt+F4= User Control ;-) rabmurdy's Avatar
    Join Date
    Mar 2002
    Location
    Ecosse
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use this method also and it works fine!

    <META HTTP-EQUIV="refresh" CONTENT="10; URL=index.html">

    Notice I never used the "http://www",

    Try either way it should work. If not post the URL and we can have a look.
    "If something is too hard,give it up. The moral my boy is too never try anything"
    "Just because I don't care doesn't mean I don't understand"

  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Location
    South Africa
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've made some changes and ir works now, the inly probelem is that when the visitor visits that page again it will redirect them again.

  6. #6
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by thokozan
    I've made some changes and ir works now, the inly probelem is that when the visitor visits that page again it will redirect them again.
    you would have to setup some sort of way to tell javascript or your server language that they have already been redirected. You could use cookies to do this. On the first reirection start a cookie with redirect=1 when they go back javascript doesn't write the <meta> tag and the user doesn't get redirected
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.

  7. #7
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Location
    South Africa
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That sounds like a good solution,problem is I'vbe never used cookies before.

  8. #8
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use this i made this for someone else, but i can't remember which thread it was under lol

    PHP Code:
    <script type="text/javascript">

        
    url  'http://www.google.com';
        
    opts '';

        function 
    getCookieVal (offset)
        {
            var 
    endstr document.cookie.indexOf (";"offset);
            if (
    endstr == -1endstr document.cookie.length;
            return 
    unescape(document.cookie.substring(offsetendstr));
        }

        function 
    GetCookie (name)
        {
            var 
    arg name "=";
            var 
    alen arg.length;
            var 
    clen document.cookie.length;
            var 
    0;
            
            while (
    clen)
            {
                var 
    alen;
                
                if (
    document.cookie.substring(ij) == arg) return getCookieVal (j);
                
    document.cookie.indexOf(" "i) + 1;
                if (
    == 0) break;
            }
            return 
    null;
        }

        function 
    SetCookie (namevalue)
        {
            var 
    argv SetCookie.arguments;
            var 
    argc SetCookie.arguments.length;
            var 
    expires = (argc) ? argv[2] : null;
            var 
    path = (argc) ? argv[3] : null;
            var 
    domain = (argc) ? argv[4] : null;
            var 
    secure = (argc) ? argv[5] : false;
            
    document.cookie name "=" escape (value) +((expires == null) ? "" : ("; expires=" expires.toGMTString())) +((path == null) ? "" : ("; path=" path)) +((domain == null) ? "" : ("; domain=" domain)) +((secure == true) ? "; secure" "");
        }

        function 
    DisplayInfo()
        {
            var 
    expdate = new Date();
            var 
    visit;
            
    expdate.setTime(expdate.getTime() +  (24 60 60 1000 365)); 
            
            if(!(
    visit GetCookie("visit"))) visit 0;
            
    visit++;
            
    SetCookie("visit"visitexpdate"/"nullfalse);
            var 
    message;

            if (
    visit <= 1window.open(url,'',opts);
        }

        function 
    ResetCounts()
        {
            var 
    expdate = new Date();
            
    expdate.setTime(expdate.getTime() +  (24 60 60 1000 365)); 
            
    visit 0;
            
    SetCookie("visit"visitexpdate "/"nullfalse);
            
    history.go(0);
        }

        
    window.onload=DisplayInfo

    </script>


    <form name="form1">
      <center>
        <input name="update" type="button" value="revisit  page" onclick="history.go(0)"  style="background-Color:white; font-size: 8pt">
        <input name="reset"  type="button" value="reset counter" onclick="ResetCounts()"  style="background-Color:white; font-size: 8pt">
    </CENTER>
    </FORM> 


Bookmarks

Posting Permissions

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