Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Javascript (http://www.velocityreviews.com/forums/f68-javascript.html)
-   -   parsing javascript from local html file (http://www.velocityreviews.com/forums/t929178-parsing-javascript-from-local-html-file.html)

Rodrigo Meza 01-11-2007 07:22 PM

parsing javascript from local html file
 
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("argumen ts"));>

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.


Randy Webb 01-12-2007 01:38 AM

Re: parsing javascript from local html file
 
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("argumen ts"));>


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/

Rodrigo Meza 03-06-2007 10:35 PM

Re: parsing javascript from local html file
 
On Jan 12, 2:38 am, Randy Webb <HikksNotAtH...@aol.com> 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("argumen ts"));>

>
> Links in that form are stupid.


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



Randy Webb 03-06-2007 11:18 PM

Re: parsing javascript from local html file
 
Rodrigo Meza said the following on 3/6/2007 5:35 PM:
> On Jan 12, 2:38 am, Randy Webb <HikksNotAtH...@aol.com> 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("argumen ts"));>

>> 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/


All times are GMT. The time now is 11:11 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.