parsing javascript from local html file

Discussion in 'Javascript' started by Rodrigo Meza, Jan 11, 2007.

  1. Rodrigo  Meza

    Rodrigo Meza Guest

    Hello Everyone
    For a project I am working on, I need to retrieve links from html
    documents. The easy part is to obtain 'plain' links like <A
    HREF="http://site/path/document">, but when those links are
    javascript'ized, the only robust solution needs to load the javascript
    and dom document representation in the same way that browsers do. For
    example, links in the form:

    <A HREF="javascript:function_declared_before("arguments"));>

    First I though that using spidermonkey (the mozilla javascript
    interpreter) should be enough, but in that case, I dont have the
    document structure elements (like document, window, document.history,
    document.form.element, etc), so I tried parsing the document using a
    library to build a tree representation of it, but that leads me to the
    same problem again, that is, I have to represent all tree nodes as
    javascript entities.

    Anybody here have worked on a similar problem? What tools do you
    think I should take a look?

    Thanks in advance!

    Rodrigo.
     
    Rodrigo Meza, Jan 11, 2007
    #1
    1. Advertising

  2. Rodrigo  Meza

    Randy Webb Guest

    Rodrigo Meza said the following on 1/11/2007 2:22 PM:
    > Hello Everyone
    > For a project I am working on, I need to retrieve links from html
    > documents. The easy part is to obtain 'plain' links like <A
    > HREF="http://site/path/document">, but when those links are
    > javascript'ized, the only robust solution needs to load the javascript
    > and dom document representation in the same way that browsers do. For
    > example, links in the form:
    >
    > <A HREF="javascript:function_declared_before("arguments"));>


    Links in that form are stupid.

    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
     
    Randy Webb, Jan 12, 2007
    #2
    1. Advertising

  3. Rodrigo  Meza

    Rodrigo Meza Guest

    On Jan 12, 2:38 am, Randy Webb <> wrote:
    > Rodrigo Meza said the following on 1/11/2007 2:22 PM:
    >
    > > Hello Everyone
    > > For a project I am working on, I need to retrieve links from html
    > > documents. The easy part is to obtain 'plain' links like <A
    > > HREF="http://site/path/document">, but when those links are
    > > javascript'ized, the only robust solution needs to load the javascript
    > > and dom document representation in the same way that browsers do. For
    > > example, links in the form:

    >
    > > <A HREF="javascript:function_declared_before("arguments"));>

    >
    > Links in that form are stupid.


    I didn't invented them, I just need to parse them :)
     
    Rodrigo Meza, Mar 6, 2007
    #3
  4. Rodrigo  Meza

    Randy Webb Guest

    Rodrigo Meza said the following on 3/6/2007 5:35 PM:
    > On Jan 12, 2:38 am, Randy Webb <> wrote:
    >> Rodrigo Meza said the following on 1/11/2007 2:22 PM:
    >>
    >>> Hello Everyone
    >>> For a project I am working on, I need to retrieve links from html
    >>> documents. The easy part is to obtain 'plain' links like <A
    >>> HREF="http://site/path/document">, but when those links are
    >>> javascript'ized, the only robust solution needs to load the javascript
    >>> and dom document representation in the same way that browsers do. For
    >>> example, links in the form:
    >>> <A HREF="javascript:function_declared_before("arguments"));>

    >> Links in that form are stupid.

    >
    > I didn't invented them, I just need to parse them :)


    I feel your pain. But it still a very bad way to have a link.

    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
     
    Randy Webb, Mar 6, 2007
    #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. =?Utf-8?B?WVNVVA==?=

    Access local port or Running local exe file

    =?Utf-8?B?WVNVVA==?=, Jan 14, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    536
    =?Utf-8?B?WVNVVA==?=
    Jan 14, 2006
  2. lurker
    Replies:
    1
    Views:
    726
    Disco Octopus
    Apr 5, 2005
  3. Lyndon
    Replies:
    1
    Views:
    551
    Leonard Blaisdell
    Jul 25, 2005
  4. Ryan McFall
    Replies:
    2
    Views:
    725
    Ryan McFall
    Jun 13, 2007
  5. Ghistos
    Replies:
    1
    Views:
    432
    Eliyahu Goldin
    Jul 14, 2008
Loading...

Share This Page