Document.referrer

I have a newb question regarding the document.referrer property (or the PHP equivalent HTTP_REFERER).

I am using a site (mturk.com) that posts templated HTML. When a person sees this HTML page, I need their ID number, which is normally found in the URL as a query variable. I used to be able to put scripting in the HTML template and grab the URL. I can no longer do this, and thought I would put a link in the HTML template taking them somewhere else where I can grab that URL using document.referrer. However, the property is always blank (it works if I link to the page from somewhere other than mturk.com though).

Under what conditions does document.referrer not work? If the referring link is within a frame? Can the referring page turn this functionality off?