It is possible to do this, but it is impossible to do this perfectly.

The problem is that JavaScript is a Turing-complete language. Therefore without actually executing all JavaScript that you run into, you can't always tell what it is going to do.

That said, you can guess. One guess is that if you see anything that looks like a URL, like http://some.domain.com/stuff, then that is probably going to be reachable somehow. Likewise the same thing URI encoded is also likely to be reachable somehow. With a few heuristics like that, you'll be able to figure out things enough to be useful, but not enough to be really reliable. As you improve the reliability of the heuristics (remember, heuristic is a fancy way of saying "it doesn't work"), the problem rapidly gets harder.

If you want more detailed advice, I'd suggest contacting cogent. He faced almost exactly your problem in a past job and had a mostly working solution (albeit he went through nightmares to get there). He has also been working on trying to parse JavaScript well enough to do better than the simple heuristic that I gave above, but I don't think that he is making enough progress. (Nudge him a little...)


In reply to Re: javascript links and robots by tilly
in thread javascript links and robots by dannoura

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.