Topic: Setting HTTP_REFERER in a hidden input without using Ruby

Can I grab the HTTP_REFERER for the value of a hidden input without depending on Ruby, PHP etc being installed? Javascript, perhaps?

Just to add some background to this; I understand the security issues with HTTP_REFERER etc - I just need to be able to capture a value. I've tried the following approaches, but the HTTP_REFERER doesn't get set in any of the examples (although the PHP echo shows that the HTTP_REFERER does exist): 

 
<input type="hidden" name="referer" value="request['HTTP_REFERER']" />
<input type="hidden" name="referer" value=request['HTTP_REFERER'] />
<input type="hidden" name="referer" value="HTTP_REFERER">
<input type="hidden" name="referer" value="$_SERVER["HTTP_REFERER"]">
<input type="hidden" name="referer" value=$_SERVER["HTTP_REFERER"]>
<input type="hidden" name="referer" value=request['HTTP_REFERER'] />
<input type="hidden" name="referer" value="request['HTTP_REFERER']" />
<input type="hidden" name="referer" value="$_SERVER["HTTP_REFERER"]" />
<input type="hidden" name="referer" value="$_SERVER["HTTP_REFERER"]" />

<?php
$referer = $_SERVER["HTTP_REFERER"];
echo $referer; 
?>


p.s. This is for a Rails app; I'm just testing the feature on a php wordpress blog running on DreamHost (it posts to my Rails app), hence the php echo...

Re: Setting HTTP_REFERER in a hidden input without using Ruby

I figured this one out using javascript;

<input type="hidden" value="none" id="referrer" name="referrer"/>
<script type="text/javascript">
  if(document.referrer)
    document.getElementById('referrer').value = document.referrer;
</script>