chimly
02-28-2005, 09:21 AM
I'm trying to modify something like:
function checkreferrer(){
if (document.referrer.substr(0,18)=='http://www.123.com/'){
playshow1();
}else{
playshow2();
}
}
... to something that will check the end of a string of unknown length for a specific file, such as 'index2.html'. The purpose of this is that I don't have a domain name yet, but I want to trigger an event like onload="checkreferrer()" ONLY when returning from a specific page deep within the window. (Likewise, returning from 'index3.html' may trigger a third show...)
One work-around might be to keep the main page in a hidden iframe and then call the function from the 'index2' page, but that may cause too much pre-loading in this case.
The important point is we don't know the length of the URL, but we do know the name of the html file at the end. So the desired "IF" test is more like:
if (document.referrer.substr(xxx,xxx)=='index2.html'){
...
}
Or something.
function checkreferrer(){
if (document.referrer.substr(0,18)=='http://www.123.com/'){
playshow1();
}else{
playshow2();
}
}
... to something that will check the end of a string of unknown length for a specific file, such as 'index2.html'. The purpose of this is that I don't have a domain name yet, but I want to trigger an event like onload="checkreferrer()" ONLY when returning from a specific page deep within the window. (Likewise, returning from 'index3.html' may trigger a third show...)
One work-around might be to keep the main page in a hidden iframe and then call the function from the 'index2' page, but that may cause too much pre-loading in this case.
The important point is we don't know the length of the URL, but we do know the name of the html file at the end. So the desired "IF" test is more like:
if (document.referrer.substr(xxx,xxx)=='index2.html'){
...
}
Or something.