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

Discussion in 'Perl Misc' started by Peng Yu, Jul 10, 2010.

  1. Peng Yu

    Peng Yu Guest

    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>
    Peng Yu, Jul 10, 2010
    #1
    1. Advertising

  2. Re: How to convert link encoded by javascript command to the actualurl?

    On 2010-07-10 17:29, Peng Yu <> wrote:
    > 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
    Peter J. Holzer, Jul 10, 2010
    #2
    1. Advertising

  3. Peng Yu

    Peng Yu Guest

    Re: How to convert link encoded by javascript command to the actualurl?

    On Jul 10, 1:15 pm, "Peter J. Holzer" <> wrote:
    > On 2010-07-10 17:29,PengYu<> wrote:
    >
    > > Suppose I see a webpage on a website that has the following link
    > > encoded byjavascript, 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 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?
    Peng Yu, Jul 11, 2010
    #3
  4. Peng Yu

    Guest

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

    On Sun, 11 Jul 2010 14:22:13 -0700 (PDT), Peng Yu <> wrote:

    >On Jul 10, 1:15 pm, "Peter J. Holzer" <> wrote:
    >> On 2010-07-10 17:29,PengYu<> wrote:
    >>
    >> > Suppose I see a webpage on a website that has the following link
    >> > encoded byjavascript, 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 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?


    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
    , Jul 12, 2010
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hb
    Replies:
    6
    Views:
    9,103
  2. Ben Amada

    URL Decode HTML encoded in JavaScript

    Ben Amada, Sep 30, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    17,846
    Ben Amada
    Sep 30, 2005
  3. cebsystems
    Replies:
    1
    Views:
    187
    Anthony Jones
    Nov 7, 2006
  4. James Howe

    Creating a URL encoded value in JavaScript

    James Howe, Apr 6, 2004, in forum: Javascript
    Replies:
    1
    Views:
    82
    Michael Winter
    Apr 6, 2004
  5. devloper
    Replies:
    0
    Views:
    70
    devloper
    Sep 7, 2007
Loading...

Share This Page