How to convert link encoded by javascript command to the actual url?

P

Peng Yu

Suppose I see a webpage on a website that has the following link
encoded by javascript, I want to user perl to parse such webpage and
convert it to the actual url. Could you please let me know what
package I should use? I thought that HTML package may not handle this.
But please let me know if I'm wrong.

<a herf="javascript:some_command_return_a_url();">Link</a>
 
P

Peter J. Holzer

Suppose I see a webpage on a website that has the following link
encoded by javascript, I want to user perl to parse such webpage and
convert it to the actual url. Could you please let me know what
package I should use? I thought that HTML package may not handle this.
But please let me know if I'm wrong.

<a herf="javascript:some_command_return_a_url();">Link</a>

I would start at
http://search.cpan.org/search?query=javascript&mode=all

hp
 
P

Peng Yu

I would start athttp://search.cpan.org/search?query=javascript&mode=all

There are many results returned. Which one is the best one to help me
solve my particular problem?
 
S

sln

There are many results returned. Which one is the best one to help me
solve my particular problem?

I'm a novice on the matter but it would seem to me that
javascript:some_command_return_a_url(); is embed and that when it
comes time to render the document, some_command_return_a_url() is
executed by a JS interp engine and assigned to that elements attribute
(href). But I'm not sure if thats the case and/or if "javascript:" is even
valid in this place (I'm too lazy to look it up at w3schools).

It would seem to me that such a package would have to be as powerfull as
a web browser with the ability to host a JS engine.
Because I don't know about these engines, I don't know if that engine
can actually call the underlying OS or that the host does, on its
behalf (sandbox and all that stuff).

It would be kind of cool to have your own back door browser that
rumages around web sites in real-time displaying a developer screen
that features a full featured debugger (like a m$ VS2008) for those
engines and html. Imagine, super automation, validation,
auto-created test cases, server hacking, scraping ..
The list is endless.

-sln
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top