$HTTP_REFERER will only be defined when there IS a referrer. So if you tested by just typing your script's name in the URL bar, then there's no referrer really, so HTTP_REFERER won't be defined. So to test your script, you should create 2 pages. One page will just output HTTP_REFERER, and the second page will just be an HTML page with a link to the PHP script. So you type the URL of the HTML page in the URL bar, click on the link, and now there should be a HTTP_REFERER. And yes, it is browser-dependent...it's up to the browser to send it or not.
Diego