"brett" <ac*****@cygen.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
When I use this code:
<select name="status" onChange =
"location.href=this.options[this.selectedIndex].value">
<option value="mypage.htm">Select View</option>
</select>
I don't have a referrer. When I click an anchor tag link, the
resulting page does have a referrer. How can I get a referrer using
the above JS?
Setting location.href in some user agents does not send the HTTP_REFERER
header. But since the referrer information is unreliable anyway <url:
http://www.datatrendsoftware.com/spoof.html />, it isn't really that big
a deal.
If you absolutely must pass it, and you are relying on JavaScript
anyway, then you could do:
<select
name="status"
onchange="
location.href =
this.options[this.selectedIndex].value +
'?referer=' + location.href;
"
(split across multiple lines for readability only)
Note that you'll need special handling on the next page (in either
client- or server-side code) to retrieve the referrer. The standard ways
of getting the value ( $_SERVER['http_referer'] in PHP for example)
won't work.
--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ -
http://jibbering.com/faq