Re: Interpreting embedded Javascript

"Nick Kew":
> On Tue, 6 Nov 2001, Tim Bagot wrote:
>
> > At 2001-11-06T17:07+0100, Ludo wrote:-
> >
> > > in other words, I desperately need the HTTP client to
> > > interpet the Javascript in order for the link checking
> > > process to proceed.
> > >
> > > Questions :
> > > 1. Did anybody Javascript-enabled the W3C validator ?
> > > 2. If not, does there exist any (non-) commercial
> > > tools that would help me ?
> >
> > I don't think the link checker is likely to support scripting of any
sort
> > in the near future:
>
> Not unless someone goes ahead and programs it.  But making something
> of the kind available as a browser function sounds a lot like some of
> Jim Ley's recent work (I'll Cc: this to him).  Jim calls his browser
> package "snufkin", so a web search on that might help.

Snork, my javascript "evaluator" would be the place to start I'd've
thought - it does a reasonable job of processing page changes in a safe
enough manner if you lock down the browser that its controlling.   The
principle is that you let the browser run the script, but you've modified
the DOM so that you can monitor what goes on, and you block page changes
and anything else that you want to.  This allows you to generate the
report, if it's just link checking then this is pretty easy.

Snork, (or snufkin, the principle is the same.) solves client side IE -
the principle should work with Mozilla and it's XUL type solutions, but
I've never had them working without significant bugs so am still holding
off  implementing them (I've not even drilled the bugs down to bugzilla
standard...) but it in principle it's doable and sometime I'll port
Snufkin to Mozilla (well try.)

On the server the problems come in with the reliance on IE, it doesn't run
well under ASP (where we have some COM support so could in theory run it.)
so making this into a hosted service is tough, even as a non-hosted
service it's not very user friendly and reliant on having win32 with IE5+
installed.

> > it could easily be a huge drain on system resources,
> > and making it secure could be very difficult. (Does there actually
exist a
> > (Java|ECMA)Script (+ DOM?) implementation outside of a browser?)
>
> I'm not sure about that.  I'd imagine the system resources should be
> in the same ballpark as existing services.

Certainly the JS interpreter and DOM parser shouldn't cost much and you
could build all checks within the single DOM (as I'm on www-validator -
I'd like an XML (or Earl of course.) output validator with XPointer rather
than line column report on the elements (delivered by thursday naturally
:-) )

>  And as for implementations,
> I may be talking through my hat, but isn't there something in the
> Netscape servers?

Yes, forget it I think, erm the word failure generally springs to mind,
not technically or anything, just it never really got used by anyone.
There are a few options available, there's lots of free ECMAScript
implementations from Mozilla's Seamonkey (c++) and Rhino (java) to FESI
(java) NJS (c++) and even Microsoft's JScript can be had in source format
(for porting only) or binary licence for just licence terms no cash - and
of course JScript works in COM under windows.  So there's no problem with
getting a javascript implementation (you use Seamonkey or JScript COM
object depending on platform inclination...)

An HTML DOM is more complicated, and I know of no solution other than
whitebeam...

> And I wouldn't be too surprised to find an Apache
> module for it.

There certainly is Peter Wilson of "Whitebeam" has an Apache module based
around Seamonkey, which is an XML and HTML parser, I've not used it
myself, but Peter definately seems to know what he's doing so I imagine it
would do most of what you want here, in fact this message from my local
comp.lang.javascript cache
a9ft7.12547$zu1.2127038@news6-win.server.ntlworld.com seems to have him
discussing a similar subject (form validation on a serverside form.)   so
I think that would be the place to start.

http://www.whitebeam.org for whitebeam of course.

Jim.

(appreciate the CC to continue I don't subscribe to www-validator.)

Received on Tuesday, 6 November 2001 18:25:43 UTC