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 6 of 6
  1. #1
    New Coder
    Join Date
    Sep 2002
    Location
    San Antonio, TX
    Posts
    57
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Javascript Redirect

    I am attempting to use a redirect so that if a user goes to http://www.zvse.com then they get redirected to http://www.illustro.com/zvse.htm with the code below....

    Code:
    <script language="JavaScript">
    if (document.referrer == 'http://www.zvse.com'){ 
    document.location.href='http://www.illustro.com/zvse.htm'
    }
    </script>
    For some reason, it doesn't seem to like the ==. If I change it to != and some different page, it forwards just fine. Both www.illustro.com and www.zvse.com point to the same place but only if the person types in www.zvse.com do we want it forwarded. Any ideas?
    ----------------------------------------
    *Let's All Do Kamikaze Shots!*
    http://www.kamikazeshots.com

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    document.referrer is the page the user came from and not the page the user is currently on. The page the user is currently on is in document.location.href which is why changing the value of that will cause the page to redirect.

    Try:

    Code:
    <script language="JavaScript">
    if (document.location.href == 'http://www.zvse.com'){ 
    document.location.href='http://www.illustro.com/zvse.htm'
    }
    </script>
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #3
    New Coder
    Join Date
    Sep 2002
    Location
    San Antonio, TX
    Posts
    57
    Thanks
    3
    Thanked 0 Times in 0 Posts
    This doesn't seem to work either....

    Normally, if you go to illustro.com, it opens intro.htm which immediately redirects to a flash page or a no flash page. The flash page, called flash.htm comes up....

    I have inserted the code you gave me in both intro.htm and flash.htm and when I go to http://www.zvse.com it doesn't redirect to the correct page :/
    ----------------------------------------
    *Let's All Do Kamikaze Shots!*
    http://www.kamikazeshots.com

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I went there and was redirected to the "No Flash" page.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #5
    New Coder
    Join Date
    Sep 2002
    Location
    San Antonio, TX
    Posts
    57
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Well that's because it did not detect that flash was installed

    Even so, the redirect to the zvse.htm should occur from intro.htm
    ----------------------------------------
    *Let's All Do Kamikaze Shots!*
    http://www.kamikazeshots.com

  • #6
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I was redirected to: http://www.illustro.com/flash.htm


  •  

    Posting Permissions

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