467,146 Members | 1,006 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,146 developers. It's quick & easy.

How do I get/read the url from the address filed in web browser

My perl file is today shown/running "inside" a web page. My task is to redirect the user to a different web page depending on which web page thta is "holding" my perl file. Unfortunately I can't work out how to obtain the url string from the web page. I have successed with the same thing using javascript which is something like:

var url = parent.window.location;
how do I do this in perl?
Please help!

/Emmalo
Aug 22 '08 #1
  • viewed: 1367
Share:
1 Reply
Expert 100+
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2. print "Content-type: text/html\n\n";
  3. my $url = $ENV{SERVER_NAME} . $ENV{REQUEST_URI};
  4. print "<html><body><h2>The URL was $url</h2>";
  5. print "<h3>The other hash variables available are:</h3><p>";
  6. foreach (sort keys %ENV) {
  7.         print "$_ = $ENV{$_}<br />";
  8. }
  9. print "</p></body></html>\n";
  10.  
Oct 1 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

12 posts views Thread by Chuck Anderson | last post: by
4 posts views Thread by David Chang | last post: by
43 posts views Thread by JohnB | last post: by
3 posts views Thread by kmercer46@yahoo.com | last post: by
12 posts views Thread by howachen@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.