• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 247
  • Last Modified:

Sniff Refferer

Is there a way to customize a homepage view using javascript to tell you who the reffer is and show a custom view of the page (with AJAX or Flash) when a certain referer is detected?  Are there any standard AJAX frameworks that do this?
0
walker6o9
Asked:
walker6o9
  • 2
1 Solution
 
js_vaughanCommented:
Javascript Code
-------------------
if((/^https?\:\/\/(www\.)?example\.com/).test(document.referrer)){
    location.href="anotherpage.html";
}

Source of code : http://www.webmasterworld.com/javascript/3564410.htm

I would go along and agree with what was mentioned on that page, which is to use htaccess if you are on an apache server.  If you have access to a server side programming language like PHP, ASP, Coldfusion... you can easily complete the task that way.
0
 
walker6o9Author Commented:
Sorry if this question is noobish, but how would I modify that to work for a non www web address, like this:

http://v01.andrew.sparrow-dev.com/redirect/
0
 
walker6o9Author Commented:
You can ignore my last comment, I got that problem solved.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now