Re: %ENV and Javascript
by chromatic (Archbishop) on Apr 03, 2000 at 07:34 UTC
|
Hash keys are case sensitive. $ENV{HTTP_referer} is not the same as $ENV{HTTP_REFERER} (unless you do some object-oriented or tied magic). Try capitalizing 'referer'.
Otherwise... are you using JavaScript to redirect the user to the script, or is it a client-side include sort of thing? This may be an example for XYZ Questions. | [reply] |
Re: %ENV and Javascript
by little_mistress (Monk) on Apr 03, 2000 at 09:05 UTC
|
| [reply] |
Re: %ENV and Javascript
by btrott (Parson) on Apr 03, 2000 at 05:38 UTC
|
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. | [reply] [d/l] |
RE: %ENV and Javascript
by Anonymous Monk on Apr 04, 2000 at 01:20 UTC
|
Why not make a subroutine to print out the %ENV hash
so you can see what is really in it?
Something like:
print_env {
foreach $key (keys(%ENV)) {
print $key, " = ", $ENV{$key}, "\n";
}
}
| [reply] [d/l] |
Re: %ENV and Javascript
by outcast (Monk) on Apr 03, 2000 at 06:43 UTC
|
i have listed all the i have done that but none I mean none of the $env are there when i open the page with javascript. | [reply] |
Re: %ENV and Javascript
by btrott (Parson) on Apr 03, 2000 at 06:47 UTC
|
Could you try posting a bit of your code? And what exactly
do you mean when you say that you "use javascript to open a cgi script"? What javascript command are you using? | [reply] |
Re: %ENV and Javascript
by outcast (Monk) on Apr 03, 2000 at 07:09 UTC
|
if ($ENV{"HTTP_referer"} eq "http://www.mysite.com/blah.html")
{
&main;
exit;
)
else
(
print "You don't belong here";
)
i am using a spanning menu,which was written in javascript, that friend of my used on his site. when i use the menu to open on of my script the $ENV{"HTTP_REFERER"} does not get created and the if statement returns false.
| [reply] |
Re: %ENV and Javascript
by outcast (Monk) on Apr 03, 2000 at 07:43 UTC
|
i am sorry REFERER is capitalized. my bad. with the java script, it is a menu with animation if you click on a catageory is drops down a sub menu and you click on one of the choice and it takes you to the the script, but that is handle on client side. | [reply] |
Re: %ENV and Javascript
by outcast (Monk) on Apr 03, 2000 at 07:13 UTC
|
yes those () instead of {} are typeos | [reply] |