in reply to %ENV and Javascript

Which environment variables are you talking about? It's possible that, for some env. variables, like HTTP_REFERER, they're not getting set because you're invoking the new window in a different way than, say, when a user clicks on a link. Browsers often only send the HTTP_REFERER variable, for example, when you've actually clicked on a link.

So, I guess the question would be: are *none* of the env. variables getting set--which would be a bit odd and would indicate some trouble, possibly--or just the specific ones that you're using?

for my $key ($keys %ENV) { print $key, ": ", $ENV{$key}, "<br>\n"; }
In case you haven't tried seeing which ones are being set already.