Click to See Complete Forum and Search --> : I don't know if this is posible but.
scragar
07-25-2003, 08:38 AM
I doubt this is posible but can you put this in your document?
<script>//I know I should use the full script type=text.... but I
//cannot be bothered.
if (history.go(-1)==http://www.yahoo.com){
alert ("thank you for using yahoo, to acsess my site")
};
Like I said I doubt this is posible but I hope it is.
P.S. if it can be done, Can it be used to check it this is the first page in this window?(so it's not got a history)
Do you have PHP on your server? If so, try this:
<?PHP
echo "Thank you for using $_SERVER['HTTP_REFERER'] to access my domain";
?>
Khalid Ali
07-25-2003, 08:48 AM
I don't think you could do that..It would be breech of brosers security model if it were possible....
kdcgrohl
07-25-2003, 09:47 AM
you could use javascript, server side includes, or i guess you could do what pyro said also. also, i would use indexOf instead of a regular ==
kdcgrohl
07-25-2003, 09:56 AM
<script>
// www.kdcgrohl.com
if (document.referrer.indexOf("yahoo.com")!= -1){
alert("thanks for using yahoo, blah blah blah");}
</script>
Javascript is not a good way to do this, as browser support is patchy, at best...
Also keep in mind that the the referrer is set by the user agent, so even in PHP, it is not gaurenteed to work. Not all user ages set it, and some provide the ability to modify it. As a result, it cannot really be trusted.
kdcgrohl
07-25-2003, 10:09 AM
true, but it doesn't seem to be a life and death matter, looks to be just for fun...
heres and ssi solution
"Thank you for using "<!--#echo var="HTTP_REFERER"--> to access my domain"
I tested the code (javascript) in IE6, Mozilla 1.2, NN7, Opera 7, and NN4.7, and it only worked in Opera 7 and NN4.7... PHP will do better than that.
kdcgrohl
07-25-2003, 10:15 AM
works fine in IE6 for me...
Khalid Ali
07-25-2003, 10:20 AM
document.referrer
is not a recommended property to use,since its web server dependent and have a potential of not working in most of the cases.
scragar
07-29-2003, 06:07 AM
Thank's, But what I was going to use it for was to see if it actualy had a past, or if it was opened in a new window, My aim was that if it opened in a new window, the link would close the window, but if it had a past it would refer them back to the page.