SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 40 of 40
  1. #26
    Skills to Pay the Bills Sparkie's Avatar
    Join Date
    Jul 1999
    Location
    A cave with 47 computers and an internet feed
    Posts
    3,559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok..tried that..still have the same problem though

  2. #27
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey Sparkie,

    I dunno why this should be so hard, but from what I read, it looks like this should work:

    Code:
    if(!document.getElementById){
    window.location="pageRedirection.html";
    }
    That says if the browser is not IE 5+ or NS 6+ or Opera 5+, go to "pageRedirection.html"

    aDog

  3. #28
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not wishing to point out the obvious... but if when you redirect your users to index.html, that presumably is not the same index.html which contains the redirect script is it? That would be why it keeps repeating itself.

    A more stable way of redirecting is by using navigator.Appname etc.
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  4. #29
    Skills to Pay the Bills Sparkie's Avatar
    Join Date
    Jul 1999
    Location
    A cave with 47 computers and an internet feed
    Posts
    3,559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Something like this?
    It still redirects me though...

    <script language="JavaScript" type="text/javascript">
    if(!document.getElementById){
    window.location="update.html";
    }
    else if(document.layers) {
    //do something for NS4.x
    window.location="update.html";
    }
    else {
    window.location="update.html";
    //Do something for everyone else
    }
    </script>

  5. #30
    Skills to Pay the Bills Sparkie's Avatar
    Join Date
    Jul 1999
    Location
    A cave with 47 computers and an internet feed
    Posts
    3,559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, its not repeating itself anymore.. just keeps redirecting me even though I'm using a browser that it should let through

  6. #31
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is what I use:

    Code:
    <SCRIPT LANGUAGE="JavaScript">
    
    function redirectPage() {
    var ie = "index.php";
    var sorry = "sorry.html";
    
    if (navigator.appName == 'Microsoft Internet Explorer')  
    window.location.href= ie; 
    else window.location.href= sorry;
    }
    
    </script>
    which just catches Netscape/Opera/and all the others.

    So you could try something like:

    Code:
    <SCRIPT LANGUAGE="JavaScript">
    
    function redirectPage() {
    var ok = "/ok/index.html";
    var update = "update.html";
    
    if (((navigator.appName == 'Microsoft Internet Explorer') && (navigator.appVersion == '6')) || ((navigator.appName == 'Netscape') && navigator.appVersion == '6')))
    window.location.href= ok; 
    else window.location.href= update;
    }
    
    </script>
    I haven't tested it and it is sorta coming off the top of my head but if all else has failed give it a go! It should send all version 6 browsers to page OK and all others to update.
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  7. #32
    Skills to Pay the Bills Sparkie's Avatar
    Join Date
    Jul 1999
    Location
    A cave with 47 computers and an internet feed
    Posts
    3,559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Seems to work, except I get a syntax error:

    Line 11
    Char 165

    www.collegetec.com/intstudies/

  8. #33
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oops. It was missing a bracket:

    Code:
    <html>
    <head>
    
    <SCRIPT LANGUAGE="JavaScript">
    
    function redirectPage() {
    var ok = "/ok/index.html";
    var update = "update.html";
    
    if (((navigator.appName == 'Microsoft Internet Explorer') && (navigator.appVersion == '6')) || 
    
    ((navigator.appName == 'Netscape') && (navigator.appVersion == '6'))) 
    window.location.href= ok; 
    else window.location.href= update;
    }
    
    </script>
    </head>
    
    <body onLoad="redirectPage()">
    
    </body>
    
    </html>
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  9. #34
    Skills to Pay the Bills Sparkie's Avatar
    Join Date
    Jul 1999
    Location
    A cave with 47 computers and an internet feed
    Posts
    3,559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <HEAD>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <SCRIPT LANGUAGE="JavaScript">

    function redirectPage() {
    var ok = "index.html";
    var update = "content/update.html";

    if (((navigator.appName == 'Microsoft Internet Explorer') && (navigator.appVersion == '6')) ||

    ((navigator.appName == 'Netscape') && (navigator.appVersion == '6')))
    window.location.href= ok;
    else window.location.href= update;
    }

    </script>


    </HEAD>
    <BODY onLoad="redirectPage()" BGCOLOR="#ffffff" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
    Still getting redirected...

  10. #35
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That is because you are sending them back to a page which has the redirection script (I assume) -- i.e. you are redirecting them to a page which redirects them to a page and so on! Change either a) the name of the page which holds the redirect script (to say redirect.html) or the name of the page which they get redirected to.

    Or am I on the wrong track here?!
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  11. #36
    Skills to Pay the Bills Sparkie's Avatar
    Join Date
    Jul 1999
    Location
    A cave with 47 computers and an internet feed
    Posts
    3,559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hrm..so if I just leave the 'index.html' alone..and save the file as redirect.html, then anyone entering the site will still be redirected? I thought I'd have to put the script into the index.html file for it to work

  12. #37
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Sparkie
    Hrm..so if I just leave the 'index.html' alone..and save the file as redirect.html, then anyone entering the site will still be redirected? I thought I'd have to put the script into the index.html file for it to work
    Well yes by default index.html (or main.html) is the page that is loaded. So you can either do two things:

    1) Save the redirect page as index.html and have the "main" page as say index1.html -- then redirect OK users to this page.

    2) Use .htaccess to set the "opening" page as redirect.html

    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  13. #38
    Skills to Pay the Bills Sparkie's Avatar
    Join Date
    Jul 1999
    Location
    A cave with 47 computers and an internet feed
    Posts
    3,559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well..I've tried and tried.

    I've got index.html as the default page that will redirect users if they're not using the "correct" browser.

    I've got index1.html as the page they are redirected to, and update.html for those who are running outdated browsers.

    I'm using IE6 and I still get sent to the update page!
    Anyone have a smiley for someone ripping their hair out?

  14. #39
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think a good one is this: !!

    This might help you out?

    http://www.webmasterbase.com/article.php?aid=619

    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  15. #40
    Skills to Pay the Bills Sparkie's Avatar
    Join Date
    Jul 1999
    Location
    A cave with 47 computers and an internet feed
    Posts
    3,559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I dont understand that at all...

    I guess I'll head off to the server scripting forum and see if anyone can help me untangle the mess
    Sherice Jacob - Web Improvement Expert
    Improve Website Conversions | eBook Covers
    Follow Me on Twitter!


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
  •