Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    Jan 2003
    Posts
    2
    Member #
    476
    Hello :-)

    I was wonderin if anybody can help...

    I want to use a script that will check a user's referrer and based on it decide if a person can continue browsing a page, or if the person should be forced to go to a certain page from which he can then access the page he wanted. I.e., if people link directly to a page within my site which isn't the entrance page, I'd like them to be redirected to the entrance page.

    I tried to use a method that required frames for this but this backfired when I had to redirect people from a page that contained iframes... plus, I couldn't see my site's referrers in my tracker.

    So I found this script in http://javascript.internet.com (that redirects people based on the referrer):

    Code:
    <SCRIPT LANGUAGE="JavaScript">
    
    <!-- Begin
    var refarray = new Array();
    refarray['excite.com'] = "page.html?from=excite";
    refarray['yahoo.com'] = "page.html?from=yahoo";
    refarray['lycos.com'] = "page.html?from=lycos";
    refarray['infoseek.com'] = "page.html?from=infoseek";
    for (var i in refarray) {
    if (document.referrer.indexOf(i) != -1) window.location.replace(refarray[i]);
    }
    //  End -->
    </script>
    Now is it possible to change this script so that what I get is that all referrers are redirected unless the referrer is my entrance page?

    Thanks for any help you can offer :-)

    Vered

  2.  

  3. #2
    Senior Member
    Join Date
    Mar 2002
    Location
    Alabama sans the damn flag
    Posts
    263
    Member #
    38
    have you looked up the URL history variable? I saw it a few days ago, but I'll have to look it up again. Essentially, it tells you the URL of the last visited page.

    Presumablty, you know what your page is...anything else would cause an immediate redirect.
    DerFarm
    I talk to squirrels.
    Squirrels Answer.

  4. #3
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    Remember though that HTTP_REFERER (the last page a user visits which is sent along with HTTP/1.1 requests) can be disabled, annoyingly enough, by some privacy protection software. Unfortunately that has the problems of not only breaking such a script but also breaking hotlink protection.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  5. #4
    Senior Member
    Join Date
    Mar 2002
    Location
    Alabama sans the damn flag
    Posts
    263
    Member #
    38
    Shouldn't be a real problem. Set up a function to return the last page visited. If the result is blank then simply return a bogus string "Came from No Damn Place" or whatever....

    then you simply compare the function results with the desired string and go with the flow. Or am I missing something?
    DerFarm
    I talk to squirrels.
    Squirrels Answer.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:39 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com