473,394 Members | 1,751 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

state of server-side javascript

Hello,

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.

I'm sure there are better ways to do this and I'm not even necessarily
looking for an extremely efficient solution. Mostly, I just want to
know if there's an existing product that could do this or with
reasonable effort could be made to do this.

Thanks!
Jeff

Jan 20 '07 #1
5 1193

"Jeff" <je************@gmail.comwrote in message
news:11**********************@51g2000cwl.googlegro ups.com...
Hello,

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.

I'm sure there are better ways to do this and I'm not even necessarily
looking for an extremely efficient solution. Mostly, I just want to
know if there's an existing product that could do this or with
reasonable effort could be made to do this.

Thanks!
Jeff
You may want to look into ASP and using IIS.
As I understand it, you can use 'J-Script' as server-side language with IIS.
I have never used JScript for Server-Side programming, so beyond here, I
couldn't help.
Jan 20 '07 #2
Jeff said the following on 1/20/2007 12:52 PM:
Hello,

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. However, if the
offending code is added via client side scripting then the only two ways
to do it are client side and having a JS parser execute it on the
server, correct it, then send it to the client. Option 2 is a *very
messy* proposition.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 20 '07 #3
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/
Jan 21 '07 #4
Martin Honnen said the following on 1/21/2007 7:38 AM:
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?
Because of the last line I quoted, mostly. If all a script is doing is
removing "any img that has 'ad' in its src" then it would indeed be
trivial to remove it on the server.

As for modifying the rest of the DOM, you are correct as I chose poor
wording for my response.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 21 '07 #5
VK

Jeff 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.
As it was already pointed by others, you can hardly remove anything
from DOM server-side, as there is no DOM yet, just raw source text. You
may of course create a virtual browser using server-side language (like
LWP and Perl) but it will make a terrible and absolutely unnecessary
overheat. A regexp parser on Perl or PHP would do the job much more
efficiently.

I have a bit OT question though: if you need to remove "any img that
has "ad" in its src" then why would you put such images into source on
the first place. And it you have a content grabber refactoring 3rd
party pages then did you come into agreement with the respective page
owners?

Now feel free to send me to hell, but I had to ask.

Jan 22 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Nhi Lam | last post by:
Hi, I understand that there are 3 modes in which I can configure the SessionStateModule. What I need is an out of process Session State store with fail over support. The "SQL Server Mode" seems...
4
by: Chad Crowder | last post by:
I've taken a look at this article http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspnet/html/asp12282000.asp which someone posted a month or so ago regarding setting up SQL...
2
by: John A Grandy | last post by:
for high traffic public websites , what are the proven options for session-state storage & management ? is an out-of-process state-server generally preferred over a sql-server ? what are the...
0
by: Jacob Jozwiak | last post by:
Hi, I hope that someone has come across this problem in their travels, because it is causing me quite a bit of grief. I apologise for the length of this question. We are running a web farm...
1
by: John Grandy | last post by:
Could someone point me in the direction of good discussions on scalable state management solutions? Specifically, pros and cons of following strategies: Strategy 1 : temporary business-objects...
6
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for...
0
by: Maciek | last post by:
Hi When I set Session state mode to StateServer (IIS 6.0; windows2003; .NET 2.0) in my application, I have recived this message:...
2
by: DC | last post by:
Hi, we are using ASP.Net 1.1 on eight servers with one session state server (the windows 2003 service). Too often we are getting the exception "Unable to make the session state request to the...
0
by: =?Utf-8?B?SkhhbGV5?= | last post by:
Our system is: IIS Server: dual Intel Xeon 2.80 GHz, 4 GB Ram Windows Server 2003 SP2 IIS 6.0 SQL Server: dual Intel Xeon 2.80 GHz, 4 GB Ram (separate server) Windows Server 2003 SP2 SQL...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.