Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

referrer script needed desparately

Status
Not open for further replies.

Skie

Programmer
Jun 21, 2004
475
US
Hi,

I am trying to write a javascript that does the following: (needs to be Javascript)

there is a sound file that is loaded on the main page
(
this sound is only loaded if the URL is accessed from another domain name. if the previous page viewed was from the same domain (blah.com), the sound is NOT played.

This seems to involve getting a referrer value and changing the action depending on it, but i honestly have no idea who to actually make the script do this. i've been trying without any luck.

Can anyone lend me a script I could use to do this?? the more thorough the better at this point, i am getting burnt on this.

Thank you VERY much.

Jennifer
 
Use this as the base for your condition:

Code:
if (document.referrer.indexOf("[URL unfurl="true"]http://www.blah.com")[/URL] != -1)
{
// code if person did NOT come from your domain
}
else
{
// code if person came from your domain
}
----------
function new Programmer(name,age)
{
this.name = name;
this.age = age;
}

var steven = new Programmer('Steven',11);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top