CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
Processing JavaScriptLink by Perl .


New User

Mar 10, 2009, 2:39 PM

Post #1 of 2 (1027 views)
Processing JavaScriptLink by Perl . Can't Post

I have a question about perl. I was trying to write a code which can access webpage in perl. I used the package CGI and LWP::simple. There’s one javascript link in that particular web page which I am trying to access. But when I do a get $url of that page and dump it to file, the website name after “JavaScriot:openlink” is missing. If I check the HTML code for the site in a browser (chorme), I can see it is there (And it opens the page on click on that link too).

<a href="JavaScript:openlink('')"></a>

Do any of you know if anything I am missing here? Or I should use any other package. I was trying CGI::Ajax (not sure thoug that it would help). But it seems not be installed in perl I am using.


Mar 10, 2009, 3:19 PM

Post #2 of 2 (1023 views)
Re: [ani.das00] Processing JavaScriptLink by Perl . [In reply to] Can't Post

Hi ani.das,

If all you need is the raw url so you can fetch it, try pre-processing your link. Perhaps something like:

if ($url =~ /a href=/) {
# It's a link.
if ( $url =~ 'JavaScript:openlink' ) {
# oops! java script. Parse the url from the argument to openlink().
$url =~ /\('([^']+)'\)/;
if ($1) {
$url = $1;
} else {
printf("Can't parse a url from $url\n");

Otherwise, you could try dealing with the javascript. I haven't done any of that, but you might take a look at this thread:




Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives