I have to determine the document.referrer of the individual coming to my
site. I want to send everyone not coming from one of those sites to an
alternate location (The names below are just used as examples).
I want to match on one of those names anywhere in the document.referrer.
In the main program I call a subroutine like this:
<script LANGUAGE="javascript" SRC="../js/redirect.js"></script>
<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0"
onload="checksource()">
inside redirect.js subroutine:
function checksource() {
if(document.referrer !~ /(equifax|transunion|experian)/) {
alert("\n\nThis function may only be accessed from a member
angency.\n\nPlease click OK to be redirected to the appropriate page.\n\n");
location.href = "http://999.999.999.999/bad_source.asp";
}
}
However, everytime this code is executed, it generates a runtime
error:error:
line:2
Error:Expected ')'
I have researched this and it seems identical to some examples I have seen.
What am I missing?
Is there a better way to do this?
Thanks for your help!