Randy Webb wrote:
>> I'd like to adapt some Greasemonkey scripts that I've written and have
>> them applied to html files on the server side before the files are sent
>> to users. I'm only looking at adapting scripts that make static
>> changes to pages. For instance, consider a script that removes from
>> the DOM any img that has "ad" in its src.
>
> If all your script is doing in the client is modifying the DOM then
> converting it to a server side script should be trivial.
Why is that trivial? A client-side Greasemonkey script has full access
to the DOM of the HTML document that the browser builds but on the
server you do not have a DOM available, you have objects to deal with
HTTP requests and create responses but no DOM implementation. It depends
on the server-side framework you use what is available but I don't know
of a server side framework that allows you to read in a HTML document to
build a DOM to manipulate it before you serialize and send the
manipulated DOM to the client.
--
Martin Honnen
http://JavaScript.FAQTs.com/