Click to See Complete Forum and Search --> : cookie reading URL
docmcneil
08-23-2003, 05:21 PM
Is there a way to read what actual URL a person entered into his/her browser to get to you.
For instance... I have www.platinum-pro.com, but I also have hotashell.platinum-pro.com
Is there a script I can use to determine if the user entered hotashell.platinum-pro.com and redirect accordingly?
Thank you!
:confused:
Khalid Ali
08-23-2003, 05:33 PM
you can get the current loaded url in the browser using
alert(window.location.href)
docmcneil
08-23-2003, 05:56 PM
Thank you sir, I appreciate the information, but I guess what I really need is an example java script that I can use to perform this function.
I'm still just below the novice level at java scripting.
Thank you!
DOC
Khalid Ali
08-23-2003, 06:15 PM
use the following code in the head section of the page,you will get the alert diplsaying the url
<script type="text/javascript">
alert(window.location.href)
</script>
docmcneil
08-24-2003, 11:57 AM
Thanks again. I did put that script in the header, and it did alert me to the origin URL.
I tried modifying a referrer/redirect script to accomodate this function, (see below) but every time the script runs,, it always goes to the last item in the array...
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var refarray = new Array();
refarray['www.platinum-pro.com'] = "index1.html";
refarray['priesttattoo.platinum-pro.com'] = "tattoo/priesttattoo.html";
refarray['hotashell.platinum-pro.com'] = "hotashell.html";
for (var i in refarray) {
if (window.location.href(i) != -1) window.location.replace(refarray[i]);
}
// End -->
</script>
I've tried MANY variations of this, and no matter what order, the script ALWAYS sends me to the last page in the array...
As it is written above, no matter what address you type in, it will take you directly to the hotashell.html page.
:confused: DOC